Open andychu opened 2 years ago
Example:
hay define AnnotatedProc
AnnotatedProc {
class = 'pure'
proc foo { # even though it's nested, it's registered in the flat proc namespace?
echo 'foo'
}
}
And that evaluates to something like
{ "type": "AnnotatedProc",
"args": [],
"attrs": {"class": "pure"},
"procs_defined": "foo",
}
And then you can read that JSON, read the annotations, and then re-execute proc with the $0 dispatch pattern.
Or even something like
List = symbol() # an atom where `[]` operator preserves the tree structure
Int = symbol()
AnnotatedProc foo {
return_type = List[Int]
proc foo {
echo hi
}
}
I think this is kind of clever -- procs are a flat namespace. But you can at least attach the name to the Hay node.
I think it will be useful for proc annotations
867