Open helins opened 2 years ago
Best if we be consistent with the Reader
convention, so that a metadata annotation causes the following form to be wrapped as a Syntax
. See: https://github.com/Convex-Dev/convex/blob/22bb34e2a2c680f9eafe674b0f688c41413f746f/convex-core/src/main/java/convex/core/lang/reader/AntlrReader.java#L310
Yes, essentially, however it's only going on IMeta
(Follow-up on a Discord question about how to circumvent this for the time being).
The Reader
converts ^{:metadata ...} value
into to a Syntax
(a type that wraps a value alongside a metadata map).
For the time being, using the $.cell/*
macro, we can actually do it ourselves using convex.cell/syntax. We can use unquote
for feeding any value that is already a cell.
Something like:
($.cell/*
(defn ~($.cell/syntax ($.cell/* set-value-in-actor)
($.cell/* {:callable? true}))
[x]
(def value
x)))
Not as pretty as a literal notation but it works.
When working with a chunk of Convex Lisp code that does not need to be generated from Clojure, I recommend writing it to a dedicated file and use the reader. Setting your editor to Clojure syntax when writing Convex Lisp files works good enough on average.
For instance:
However metadata in CVX behave differently so this deserves some thoughts.