Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

object method call simplification #311

Closed
bobzhang opened this issue Mar 6, 2021 · 3 comments · Fixed by #348
Closed

object method call simplification #311

bobzhang opened this issue Mar 6, 2021 · 3 comments · Fixed by #348

Comments

@bobzhang
Copy link
Member

bobzhang commented Mar 6, 2021

Thanks to the recent clean up, there is no need to apply a ppx for method call.

obj["say"] was currently compiled into obj##say, and transformed again in the compiler into Pexp_send with some wrappers.

This is not needed any more, it can be translated into obj#say without any post-processing.

To finish this, we should also implement the printer logic for Pexp_send

@chenglou
Copy link
Member

chenglou commented Mar 8, 2021

What happens to #=?

Edit: seems mixing the two causes an assertion error:

Screen Shot 2021-03-08 at 2 42 45 PM

@bobzhang
Copy link
Member Author

bobzhang commented Mar 9, 2021

This is not finished yet. currently you use person##name #= "hi", but we will support person#name #= "hi" soon.
Note I tested the assignment in rescript syntax, it does not seem correct.

@bobzhang
Copy link
Member Author

bobzhang commented Mar 9, 2021

@chenglou The error is fixed in rescript-lang/rescript#4986. So we can simplify the method call in ReScript syntax now.

IwanKaramazow pushed a commit that referenced this issue Mar 25, 2021
Fixes #311

`obj["say"]` was currently parsed as `obj##say` (Pexp_apply with ##)
We now parse this straight into `obj#say`(Pexp_send)
IwanKaramazow pushed a commit that referenced this issue Mar 25, 2021
Fixes #311

`obj["say"]` was currently parsed as `obj##say` (Pexp_apply with ##)
We now parse this straight into `obj#say`(Pexp_send)
IwanKaramazow pushed a commit that referenced this issue Mar 25, 2021
Fixes #311

`obj["say"]` was currently parsed as `obj##say` (Pexp_apply with ##)
We now parse this straight into `obj#say`(Pexp_send)
IwanKaramazow added a commit that referenced this issue Mar 25, 2021
Fixes #311

`obj["say"]` was currently parsed as `obj##say` (Pexp_apply with ##)
We now parse this straight into `obj#say`(Pexp_send)

Co-authored-by: Iwan <[email protected]>
kevinbarabash pushed a commit to kevinbarabash/rescript-compiler that referenced this issue Dec 24, 2021
…g#348)

Fixes rescript-lang/syntax#311

`obj["say"]` was currently parsed as `obj##say` (Pexp_apply with ##)
We now parse this straight into `obj#say`(Pexp_send)

Co-authored-by: Iwan <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants