Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receive semantics #63

Open
0xshipthecode opened this issue Feb 9, 2014 · 4 comments
Open

receive semantics #63

0xshipthecode opened this issue Feb 9, 2014 · 4 comments

Comments

@0xshipthecode
Copy link

Apologies for cross-posting but the joxa mailing list seems to be dead.

I see a difference in semantics of the joxa receive form and erlang receive. In erlang, a message not matching any patterns in a receive simply sits in the mailbox and receive keeps waiting until it matches. In joxa, sending a message that does not match any pattern in a receive results in a case_clause exception.

Compiling a simple test case from erlang to core erlang and from joxa to core erlang shows that joxa adds an extra case to the receive which matches everything and generates the case_clause.

In erlang the match everything pattern resulting in a case_clause error is only added for 'case' but not for 'receive'.
Joxa adds this for both receive and case, this seems to be due to :case and :receive expressions in joxa-cmp-expr using the same joxa-cmp-case/make-pattern function to generate the cerl-clauses.

Is this intentional? From #26 I got the impression that receive was supposed leave non-matching messages in the mailbox but it's an old message.

Thanks,

  • Martin
@ericbmerritt
Copy link
Contributor

@vejmelkam this is a way better place to post i suspect. I don't even remember getting a mail from the mailing list in quite some time.

You are right. Receive should not add that extra case clause. I suspect strongly this is a problem of code reuse. I will look into it.

@0xshipthecode
Copy link
Author

Thanks for merging the vejmelkam/fix-receive-clause-generation fix. However a vanilla compile of a checked out erlware/joxa commit 8d033225fc still has the incorrect receive semantics.

To fix this, I regenerated the joxa-cmp-case.ast and joxa-cmp-expr.ast files only (by deleting them and then running build-support/build.erl ast src src/ast. After that make escript then generates the correct escript.

Could someone with repository access regenerate the two files? Alternatively I can generate a pull request from my fork.

@ericbmerritt
Copy link
Contributor

@vejmelkam they should be regenerated automatically from the build. It would probably go much quicker if you would generate them and submit a PR.

@ericbmerritt
Copy link
Contributor

otherwise I will get to it as soon as I can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants