Fork me on GitHub
#yamlscript
<
2023-08-06
>
Ingy döt Net17:08:05

Today I had a major YAMLScript design breakthrough. I realized that YS has a need for its own "macro" definitions and "special forms". For example the preferred YS if syntax is:

if (a == b):
- foo
- bar
# or (simpler in this case):
if (a == b): foo bar
rather than the more general function call style:
if:
- (= a b)
- foo
- bar
Right now I special case if in the YS reader library (along with several other common things), but today I realized these special cases are going to be super common so I need a way to define these as "YS macros". The YS way to do a def is:
foo =: 123    # (def foo 123)
This is more of a YS "special form", because I can't namespace it under foo like I can for the previous if. I think that a well thought-out YS macro system should greatly simplify a YS implementation, as there will be way less special cases. Reminder: all these YS things simply get translated to Clojure forms by the YS reader library. Also when I say ys-macro or ys-special-form what it translates to in Clojure is not related.