3 ms·
Domain specific languages. They always end up being hacks in Python and are almost impossible everywhere else. Numpy, various ORMs and so on. Since you get a
by mordae 4y ago
Domain specific languages.
They always end up being hacks in Python and are almost impossible everywhere else. Numpy, various ORMs and so on.
Since you get a built-in de-facto compiler (macro expander), implementation of such DSLs is pretty easy. Racket, for example, has pretty good support for pattern matching and error reporting during macro expansion, which makes the DSLs debuggable.
Typed Racket has implemented a type-checked layer on top of the regular Racket with automatic unboxing of numeric types whenever they provably don't have to be boxed. You can mix typed and untyped code freely with contracts being inserted at the boundary. That means you can implement a busy loop in typed code with unboxed integers and only guard the inputs and outputs. The potential clearly is there.