-
Notifications
You must be signed in to change notification settings - Fork 2
paths
EricGebhart edited this page Sep 23, 2021
·
2 revisions
Symbols can be defined to represent paths. Those symbols can then be used in other commands, when accessed they will resolve to their value. Here is a sample session which creates some yaml, then a path to that yaml, showing how the show command works with the new symbol.
These paths are a bit like macros. They are resolved to their values before the interpreter tries to execute. They act like normal computer language variables in some respects.
At the same time as being able to resolve a value, they also point to the place where the value is, So it is possible to use them in interesting ways. As in the way the results stack works.
Here's a sample session to ponder.
SPR:> '
YAML...>foo:
YAML...> bar: show /foo/baz
YAML...> baz: 110
YAML...>
SPR:> show foo
bar: show /foo/baz
baz: 110
SPR:> def-path sbaz "foobaz" /foo/baz
SPR:> sbaz
Unkown Symbol: 110
SPR:> def-path showbaz "foobaz" /foo/bar
SPR:> showbaz
110
SPR:> set /foo/bar show /foo
SPR:> showbaz
bar: show /foo
baz: 110