Hacker News new | ask | show | jobs
by jen20 1019 days ago
DSLs need not be declarative.

DSLs need not be succinct.

DSLs need not be close to English at all.

All of these are properties which may or may not apply to a _specific_ DSL, they are not defining features.

1 comments

But they can be. They can have nice properties that general purpose languages cannot.
Why not?
Well the reasons for each point are a bit different so let's go through them one by one.

A declarative language cannot be general purpose by definition.

Succinctness. If you know exactly the domain you are talking about it means you can use many shortcuts and abbreviations that would be unclear otherwise. We all know this is true for natural languages, and it is also true for programming.

Close to English. In this case the reasons are more about aesthetics. English is not particularly good for general purpose computation as it struggles to express complex ideas with enough precision that it is crystal clear what is meant. A reader must apply some common sense to disambiguate. A general purpose language close to English would either be a Turing tarpit, or it would be a close-to-english language with some general purpose computation things bolted on.

> A declarative language cannot be general purpose by definition.

Prolog is both declarative and general purpose.

> Succinctness

life ← {⊃1 ⍵ ∨.∧ 3 4 = +/ +⌿ ¯1 0 1 ∘.⊖ ¯1 0 1 ⌽¨ ⊂⍵}

> Close to English.

We disagree that this is even desirable (and why English, rather than Hebrew or Dutch?) - but BASIC is a pretty good example of a general purpose language which is close to English.