Path system
From HalyardWiki
Goals:
- Make the path clean and correct.
- Make the path system far less "magic".
- Preserving backwards compatibility is not a priority.
- The new system should be conceptually simple and syntactically reasonable.
Important facts about the world:
- Static nodes may exist without corresponding dynamic nodes.
- Dynamic nodes may exist without corresponding static nodes.
Path-like behaviors we want to support:
- Absolute paths:
@/index - Parent lookup:
@../answer(a bad idea in many cases, except for(def (click) ...)handlers inline in their containing card). - "Current working directory" is relative to
self. - An API for asking a node to resolve a path relative to itself.
- A nice notation or API for resolving a path relative to the current card, particularly for use in functions with no
self.
The big question: How do we handle the dynamic versus static node issue? Two separate path notations? Magic like the current magic?
[edit] Tricky corner cases
This wants to bind to the initializer proxy:
(attr index-card @../index)
Functions like .jump and .wait always know how they should be resolved (static or dynamic), but about instance-of?:
(attr index-card :type <card>)
These two uses of @something resolve differently:
(elem foo (%foo% :bar @something) ...) (elem foo (%foo%) (value bar @something))
And top-level card declarations have no self available in their node parameter list, either.
Perhaps we want @foo to always resolve relative to the current card, and have a nice syntax/API for resolving relative to the current node?
[edit] Things we can try
Here are some cans of worms that we may choose to re-open if it gets us a particularly elegant solution:
- We can move
elemforms insidesetup, and make them work via class lambdas and amethod-missingoverride that maps method names to child element names. - We can, in general, redesign how
elemworks. - Should any other redesigns be fair game?
If we get into any of these heavier changes, we definitely want to work on a branch.

