@@ -151,11 +151,12 @@ expressions_. Most of the interesting stuff that Please does involves evaluating
151151keyword expressions.
152152
153153Under the hood, keyword expressions are modeled as objects. For example, ` :foo `
154- desugars to ` {@lookup query : foo} ` . All such expressions have a key ` 0 `
155- referring to a value that is an ` @ ` -prefixed atom (the keyword). Keywords
156- include ` @function ` , ` @lookup ` , ` @apply ` , ` @check ` , ` @index ` , and ` @runtime ` .
154+ desugars to ` {@lookup key : foo} ` . All such expressions have a key ` 0 ` referring
155+ to a value that is an ` @ ` -prefixed atom (the keyword). Keywords include
156+ ` @function ` , ` @lookup ` , ` @apply ` , ` @check ` , ` @index ` , and ` @runtime ` .
157157
158- Currently only ` @function ` , ` @lookup ` , and ` @apply ` have syntax sugars.
158+ Currently only ` @function ` , ` @lookup ` , ` @index ` , and ` @apply ` have syntax
159+ sugars.
159160
160161### Semantics
161162
@@ -233,14 +234,20 @@ It desugars to the following `plo` program:
233234 function: {
234235 0: @apply
235236 function: {
236- 0: @lookup
237- query: atom.prepend
237+ 0: @index
238+ object: {
239+ 0: @lookup
240+ key: atom
241+ }
242+ query: {
243+ 0: prepend
244+ }
238245 }
239246 argument: "Welcome to "
240247 }
241248 argument: {
242249 0: @lookup
243- query : language
250+ key : language
244251 }
245252 }
246253 now: {
@@ -249,8 +256,15 @@ It desugars to the following `plo` program:
249256 0: @function
250257 parameter: context
251258 body: {
252- 0: @lookup
253- query: context.program.start_time
259+ 0: @index
260+ object: {
261+ 0: @lookup
262+ key: context
263+ }
264+ query: {
265+ 0: program
266+ 1: start_time
267+ }
254268 }
255269 }
256270 }
@@ -269,8 +283,15 @@ Which in turn compiles to the following `plt` program:
269283 0: @function
270284 parameter: context
271285 body: {
272- 0: @lookup
273- query: context.program.start_time
286+ 0: @index
287+ object: {
288+ 0: @lookup
289+ key: context
290+ }
291+ query: {
292+ 0: program
293+ 1: start_time
294+ }
274295 }
275296 }
276297 }
@@ -283,7 +304,7 @@ Which produces the following runtime output:
283304{
284305 language: Please
285306 message: "Welcome to Please"
286- now: "2025-01-27T16:06:55.802Z "
307+ now: "2025-02-14T18:45:14.168Z "
287308}
288309```
289310
0 commit comments