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

Implement message cascade #176

Merged
merged 1 commit into from
Jul 26, 2017
Merged

Implement message cascade #176

merged 1 commit into from
Jul 26, 2017

Conversation

smarr
Copy link
Owner

@smarr smarr commented Jul 26, 2017

This change introduces support for Smalltalk message cascades, i.e., syntax to send multiple messages to the same receiver by listing them with ; as separator.

  • add lexing of semicolon
  • includes basic tests
  • uses a normal immutable local to store the receiver, should perhaps become an internal variable instead. Benefit of local is that we see it in the debugger

I decided against an implementation with a separate node, because it would require introducing an executeWithReceiver method, which seems a more substantial change than simply desugaring into existing constructs.
Replacing the lastReceiver is a bit of a hack, and requires the previous message to adopt its children during parsing. However, this seems to be a simpler solution than delaying the assembly of those expressions.

@smarr smarr added the enhancement Improves the implementation with something noteworthy label Jul 26, 2017
@smarr smarr added this to the v0.5.0 milestone Jul 26, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 80.19% when pulling 497053e on ns-message-cascades into 00f1fe9 on dev.

This change introduces support for Smalltalk message cascades, i.e., syntax to send multiple messages to the same receiver be listing them with ; as separator.

- add lexing of semicolon
- includes basic tests
- uses a normal immutable local to store the receiver, should perhaps become an internal variable instead. Benefit of local is that we see it in the debugger
- I decided against an implementation with a separate node, because it would require introducing an executeWithReceiver method, which seems a more substantial change than simply desugaring into existing constructs
- the replacing of the lastReceiver is a bit of a hack, and requires the previous message to adopt its children during parsing. However, this seems to be a simpler solution than delaying the assembly of those expressions

Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr merged commit 3551a94 into dev Jul 26, 2017
@smarr smarr deleted the ns-message-cascades branch July 26, 2017 14:21
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 80.208% when pulling 793eb6b on ns-message-cascades into 00f1fe9 on dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the implementation with something noteworthy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants