Simplify event argument API: use arg instead of t_arg - #325
Merged
Merged
Conversation
`_event( arg = x )` is the one-value spelling of `t_arg = VALUE #( ( x ) )` — the client folds it into the same string_table, so the wire and `get_event_arg( )` are byte for byte what they were. The app that every reader meets first (the front page, and the twelve walkthrough steps that build it) was still spelling a single row out as a table constructor longer than the value inside it, which is the notation it then teaches by example. The wire now fits on one line, so the `val =` padding that only existed to align with the `t_arg =` continuation goes with it. Step 6, where the argument is introduced, names `arg` and says what it is short for and where `t_arg` takes over (from two values on). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLUuftzubB7iRprxsDtVxD
The Backend page is where an event argument is introduced, so it taught the notation the rest of the site then copied: `t_arg = VALUE #( ( x ) )` for a single value, where `arg = x` is the same wire - the client folds it into the same string_table and `get_event_arg( )` reads it back unchanged. All four examples on the page (source, parameters, event object, model property) carry exactly one argument, and now say so; the comment lines between `val` and the argument keep their place, so the multi-line shape stays where it earns it. What the page loses by that - the table form itself - it gets back as a sentence: from two values on, `t_arg` is the parameter, in that order, read with `get_event_arg( 2 )` and up. Value help was the one remaining wire of that shape on the site, and fits on one line now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLUuftzubB7iRprxsDtVxD
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.
Summary
Refactors the event argument API across all documentation to use the simpler
argparameter for single-value cases, replacing the more verboset_arg = VALUE #( ( ... ) )syntax. Thet_argparameter remains available for multi-value scenarios.Key Changes
arg = valueinstead oft_arg = VALUE #( ( value ) )for single argumentsargis the single-value spelling oft_arg, and that they are equivalent on the wire_event()calls across all code examples (removed extra spaces around=)t_argtoargin inline documentation and method commentsFiles Updated
docs/cookbook/event_navigation/backend.md— Added detailed explanation ofargvst_argrelationship; updated all three event examples (Source, Parameters, Event)docs/tutorials/walkthrough/step-6.md,step-7.md,step-9.md,step-10.md,step-12.md— Simplified event argument syntaxdocs/cookbook/expert_more/value_help.md— Simplified value help picker eventdocs/index.md— Updated homepage exampleImplementation Details
argandt_argremain equivalent:arg = xis exactlyt_arg = VALUE #( ( x ) )t_argwith table syntax and retrieve withclient->get_event_arg( 2 ),( 3 ), etc.https://claude.ai/code/session_01JLUuftzubB7iRprxsDtVxD