3 ms·
General purposes programming languages that enable to easily and expressivelly build readable DSLs are useful. But what does Racket bring over say Kotlin DSLs?
by The_rationalist 6y ago
General purposes programming languages that enable to easily and expressivelly build readable DSLs are useful.
But what does Racket bring over say Kotlin DSLs?
https://kotlinlang.org/docs/type-safe-builders.html https://kotlinlang.org/docs/type-safe-builders.html
For building DSLs the following features are useful:
Infix/postfix functions,
Operator overloading,
Varargs/spread operator,
Scope controling what is allowed.
Other features??
- rscho 6y agoI'm not a Kotlin expert, but I expect that it enables easily interpreted DSLs. Racket enables easy compiled DSLs through its macro system. So, no interpretative overhead. Also you can really, really change both syntax and semantics: https://docs.racket-lang.org/2d/ https://docs.racket-lang.org/2d/ Although not similar technically speaking, Graal/Truffle is a better comparison in spirit, IMO. But Graal/Truffle is hugely complex, with many many man-hours in it. Classic example and discussion: https://www.reddit.com/r/programming/comments/i1slm/comment/c20a8ov https://www.reddit.com/r/programming/comments/i1slm/comment/... https://www.hashcollision.org/brainfudge/index.html https://www.hashcollision.org/brainfudge/index.html
- The_rationalist 6y agoI think the DSL logic is at compile time, the Kotlin annotation generate source code at compile time just like a macro and enable compile time type safety. Also the performance is expected to be order of magnitude better given the JVM. Also you can really, really change both syntax and semantics: https://docs.racket-lang.org/2d/ https://docs.racket-lang.org/2d/ Exactly, racket give you much more freedom because of this, I don't know the use cases but it's indeed more powerful. A comparison with Truffle would be great! I wonder if a higher level/simpler but less powerful abstraction on top of Truffle could bridge the difficulty gap.