Add '<-', a message send that yields the recipient - #60
Merged
Conversation
Where "->" evaluates to the last value of the method it ran, "<-" evaluates
to the object that received the message. That makes sends chain --
(system <- 'INIT SORTER' <- "dog" <- "cat") -- which suits system's
protocols, where the sequence of messages is the point and the replies are
not. It also lets a stateful recipient be primed inside a larger
expression: ("grab" -> (system <- 'WHICH OBJECT')) is the one-line form of
what previously took two statements.
The operator groups to the left, which is what makes chaining work at all:
each send hands the recipient back for the next one to send to. It shares
"->"'s precedence, so an unparenthesized mix of the two would reassociate
into something nobody intends; that is refused at parse time rather than
quietly obeyed.
OP_SEND_TO is appended to the operator enum rather than filed alphabetically
next to "<". Those enumerators are the ints written into .acx files, so
inserting one in the middle would invalidate every compiled game and save
file in existence.
Experimental, and parked on a branch until it earns its place: this adds a
second way to say something the language could already say.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LscjcoeFJ4R4w2AAs193Yo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Where `->` evaluates to the last value of the method it ran, `<-` evaluates to the object that received the message. That makes sends chain — `system <- 'INIT SORTER' <- "dog" <- "cat"` — which suits system's protocols, where the sequence of messages is the point and the replies are not. It also lets a stateful recipient be primed inside a larger expression: `"file.acx" -> (system <- 'LOAD STATE')` is the one-line form of what previously took two statements, and unlike the pure chain it keeps the final send's reply.
An unparenthesized mix of `->` and `<-` would reassociate into something nobody intends; that is refused at parse time rather than quietly obeyed. `OP_SEND_TO` is appended to the operator enum rather than filed alphabetically, since those enumerators are the ints written into `.acx` files.
Rebased onto main; the only conflicts were both sides appending a test method to the same two lists in `TestSystemObject`, resolved by keeping both. All 18 test suites pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AUmuc82NHf76PrRYjgLhq5