3 ms·
While i do like the the idea of DSLs and they certainly do have a place, what I would love to have is to be able to enforce a strict subset of a language in a p
by mtrycz 10y ago
While i do like the the idea of DSLs and they certainly do have a place, what I would love to have is to be able to enforce a strict subset of a language in a piece of code.
Where first there was discipline and hardly passed on conventions, there now would be statically enforced rule coerction.
I deeply believe that the utility of language is not in what it enables, but in what it forbids. For example Clojure and Rust have neat mechanisms to deal with mutability, where you need something extra to mutate a value. Contrast this to C where you need to go extra lenghts to make things const (ie nobody'll do it).
Is this even possible without writing your own tools?
- klibertp 10y agoRacket. It's built as a platform for defining arbitrarily simple or complex languages and integrating them together. You should take a look at it. See http://www.ccs.neu.edu/home/matthias/Thoughts/Racket_is____.html http://www.ccs.neu.edu/home/matthias/Thoughts/Racket_is____.... : > To a language designer, Racket is a programming language laboratory. This does not mean that the language is unstable. The designers do not change the language in a whimsical manner. That is, Racket comes with a unique collection of linguistic mechanisms that enable the quick construction of reliable languages, language fragments, and their composition. These tools are so easy to use that plain programmers can design a language after a little bit of instruction. So when a well-trained programmer decides that none of the available dialects is well-suited for a task, he designs a new dialect and writes his program in it. As Paul Hudak said, “the ultimate abstraction is a domain specific language.”
- sklogic 10y agoYou can have both a flexibility of DSLs and strict rule enforcement. Just write a restricted DSL.
- jeffreyrogers 10y agoSome languages have this. For example, SPARK is a subset of Ada that can guarantee certain properties about your code. Similarly D has a subset that the compiler will verify is type and memory safe.