Clojure allows symbols to be any combination of a certain set of characters.
> Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, ', ?, <, > and =
YS is much stricter. Basically it supports the style of symbols that are actually used in clojure.core.
This leaves room for other syntax down the road.
Currently I'm making it so that the compiler will look/lex for a valid clojure symbol, but then error if it is not a valid YS symbol or construct.
The only outlier I've actually seen is stuff like foo->bar which could easily be expressed as foo-to-bar.
Are there others I should be aware of?
We could consider the -> gimmick to be "used in clojure.core" inasmuch as defrecord Foo creates constructor functions named ->Foo and map->Foo for you.
I need to learn more about defrecord.
I should have said the clojure.core subset available in SCI.
The map->Foo defrecord thing does work in SCI (checked with bb)
I'll add that to the YS symbol rules.
Is the char after map-> always uppercase? I prefer to be as strict as possible, since you can always be more lenient as needed.
Here's the "weirdos" I get from bb's ns-refers:
+'
->Eduction
StackTraceElement->vec
Throwable->map
as->
bound-fn*
cond->
cond->>
inc'
list*
multi-fn?-impl
not=
read+string
tap>
I will likely elide the ones ending in ' or *.
Forgot about not=...Why not just make YS accept only munged output? This gives you about the same level of tokens as other languages (e.g. Java, JavaScript), thus retaining the flexibility you want for YS syntax
For example, (munge 'foo->bar) returns the symbol foo__GT_bar
the munged names are ultimately what gets stored in e.g. the compiled output of clojurescript files
e.g. cljs.core/->Eduction refers to the javascript object cljs.core.__GT_Eduction
YS doesn't even allow _
ah, that complicates things 😄
Well you could substitute _ with -
YS also doesn't allow --
Basically it allows what people actually use
And what prominent clojure actually uses
What is tap> btw?
Asynchronously calls a set of "tap functions" with the inputted value. Mostly used for logging data and sending it to an external tool (like the shadow-cljs object inspector)