You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ion 1.1 allows users to define templates--reusable data shapes that can be invoked as many times as needed--that expand to zero or more Ion values.
This issue builds on #656 and #657, and tracks building the machinery needed to evaluate invocations of a user-defined template macro. Such invocations can appear in two places:
In the data stream, encoded using an e-expression.
In the body of another template, encoded as an s-expression.
The latter requires implementing the ability to pass named parameters (i.e. variables) from the host template's environment to the macro being invoked.
For example:
// Template definition
(macro
greet // Template name
(part_of_day name) // Parameter names
(make_string // Template body
"Good "
part_of_day
", "
name
"."))
(:greet "morning" "Mr. Cartwright")
// Notionally expands to the intermediate equivalent:
(:make_string "Good " "morning" ", " "Mr. Cartwright" ".")
// Which evaluates to:
"Good morning, Mr. Cartwright."
In this case, the named parameters part_of_day and name are passed from the environment of the greet invocation to the environment of the make_string invocation.
The text was updated successfully, but these errors were encountered:
Ion 1.1 allows users to define templates--reusable data shapes that can be invoked as many times as needed--that expand to zero or more Ion values.
This issue builds on #656 and #657, and tracks building the machinery needed to evaluate invocations of a user-defined template macro. Such invocations can appear in two places:
The latter requires implementing the ability to pass named parameters (i.e. variables) from the host template's environment to the macro being invoked.
For example:
In this case, the named parameters
part_of_day
andname
are passed from the environment of thegreet
invocation to the environment of themake_string
invocation.The text was updated successfully, but these errors were encountered: