Live data from Hacker News

DSLs are a waste of time

leebriggs.co.uk

91–100 of 165 posts

Re: DSLs are a waste of time

#91
post #7
post #4

I think calling terraform a DSL in comparison to general purpose programming languages misses the point. If it used a declarative GPPL instead of HCL I wouldn't care, but imperative alternatives general purpose or not are 'a waste of time' & not fit for the domain, IMO.

Pulumi is an example that proves the exception: using a general purpose language, you create a declaration of desired state. Think of it like if you used a GPPL to emit HCL. You get the power of that language: loops, function calls, unit tests, or even the ability to call external APIs. You're declaraing desired state and letting the framework sort it outb which is you say you aren't writing imperative code like: if…

I didn't name it, but Pulumi's the main (multiple) GPPL alternative I was thinking of. I don't think emitting/compiling to something declarative makes it any better; maybe if you normalised that being the key checked-in thing, a bit like a lockfile, but which people really checked and cared if it changed, more so in a way than the source.

I want to write and review declarative, not compiles-to-declarative.

Re: DSLs are a waste of time

#92

Programming languages will always be better, more feature rich and more capable than any DSL. However, the whole reason things like terraform or puppet become popular is because the people who write the DSL don't consider themselves "programmers" and they don't want to be thought of as "programmers". As somebody who identifies as a "programmer" and often has to manage infrastructure I would absolutely love for a seri…

Very much agree, I do wonder how can things like crontab be specified? The cron job syntax is its own fricking thing that I have to always look up. But then, I wonder, how else can it be specified? yaml file?

Re: DSLs are a waste of time

#93
post #88
post #71

Earlier quoted context omitted.

I think your examples are spurious and wrong, when compared with the specific kind of DSL the article talks about. SQL is a "Fourth Generation Language", much like Prolog, which is quite different to what is being discussed. HTML isn't a DSL; it's a type of SGML, a specific document markup language - you can't just shout "DSL" and squint a bunch and assume "All sort-of-languages are DSLs". Regular expressions, sure,…

I think the problem here is more that people still need to work on their positions to figure out what they really mean, because while you have some points, regular expressions are the canonical example of a DSL. Their domain is strings, and they make certain things you want to do in them very easy to express. The problem here is that while you can say “Terraform is more than a DSL” - if you ever back the layers or tr…

Aren’t regular expressions the abstraction to state machines? They all get converted to a DFA or NFA, no?

Re: DSLs are a waste of time

#94
post #6
post #4

I think calling terraform a DSL in comparison to general purpose programming languages misses the point. If it used a declarative GPPL instead of HCL I wouldn't care, but imperative alternatives general purpose or not are 'a waste of time' & not fit for the domain, IMO.

CDK for Prolog would be quite the trip. As it turns out, what matters is whether the model is declarative. As some uses of YAML go to show, declarative vs not is an orthogonal axis to how general purpose or otherwise a language is, and orthogonal again to whether it looks like a configuration file or code.

Yes I absolutely wasn't saying declarative means not GP or vice versa, that was really my only point: I don't mind a terraform alternative that uses (or if terraform switched to) a general purpose language as opposed to 'DSL', if we can call the current incarnation that, as long as it (the GP language) is declarative.

Re: DSLs are a waste of time

#95
post #88
post #71

Earlier quoted context omitted.

I think your examples are spurious and wrong, when compared with the specific kind of DSL the article talks about. SQL is a "Fourth Generation Language", much like Prolog, which is quite different to what is being discussed. HTML isn't a DSL; it's a type of SGML, a specific document markup language - you can't just shout "DSL" and squint a bunch and assume "All sort-of-languages are DSLs". Regular expressions, sure,…

I think the problem here is more that people still need to work on their positions to figure out what they really mean, because while you have some points, regular expressions are the canonical example of a DSL. Their domain is strings, and they make certain things you want to do in them very easy to express. The problem here is that while you can say “Terraform is more than a DSL” - if you ever back the layers or tr…

If you re-read my reply, you'll see that I said that regex is a DSL, but doesn't apply for different reasons.

Re: DSLs are a waste of time

#96
post #93
post #88

Earlier quoted context omitted.

I think the problem here is more that people still need to work on their positions to figure out what they really mean, because while you have some points, regular expressions are the canonical example of a DSL. Their domain is strings, and they make certain things you want to do in them very easy to express. The problem here is that while you can say “Terraform is more than a DSL” - if you ever back the layers or tr…

Aren’t regular expressions the abstraction to state machines? They all get converted to a DFA or NFA, no?

Exactly. The languages in the article are nothing of the sort.

Re: DSLs are a waste of time

#97
Hmmm. I just have to strongly disagree. I hit those hard spots in terraform, just like I did in puppet years ago. But I'd still prefer to use a DSL for configuration management (because that's what both are). Puppet actually managed to get to a very usable state by v5, if used with hiera, you could essentially define some types and fling data at them using 'create_resources', which is the equivalent of "for each" over a data set. If you stick to that pattern and make good use of hiera, your codebase will be compact and easy to reason about. The difference between your environments will be a few lines of yaml. In fact I use his with terraform, to that same end. I've looked at pulumi and I just don't like it. Terraform has it's quirks and limitations but I still prefer it.

Maybe DSLs are a waste of Lee's time because he knows they'll be "dead languages" when the next major evolution of systems takes place. But meh, I'll learn the next DSL, and maybe even hook hiera up to it too.

Re: DSLs are a waste of time

#99
Surely all programming is essentially the creation of a domain specific language, or at least a domain specific vocabulary that describes entities in the domain, the actions that they can perform, and the messages that they can send and receive. You can be fluent in Fortran yet be completely bewildered by a Fortran program because the vast bulk of the meaning is in a language that you have yet to learn.

As for being left with expertise in a language that no one uses any more, welcome to the club. My first language was Algol-60, the next was Leasco Basic, after that I wrote some Fortran IV, then whatever dialect of Dartmouth Basic was on the Exeter Uni time sharing system, then Z80 assembler, then 6502 assembler, followed by Turbo Pascal in its various versions (I skipped all the 'standard Pascals), more Fortran (but I forget which version) then VB4, 5, 6, then VB.Net then C#. SQL was involved for quite a lot of the time too. Then I retired and now I play with Nim.

Were all of those a waste of time too? I certainly have no use for the specifics of Fortran, Algol, Dartmouth Basic, VB.Net, any assembly language, or even C# now, but they were all useful at the time and I created things that were important and valuable for the companies in which I worked.

Re: DSLs are a waste of time

#100
post #86
post #71

Earlier quoted context omitted.

I think your examples are spurious and wrong, when compared with the specific kind of DSL the article talks about. SQL is a "Fourth Generation Language", much like Prolog, which is quite different to what is being discussed. HTML isn't a DSL; it's a type of SGML, a specific document markup language - you can't just shout "DSL" and squint a bunch and assume "All sort-of-languages are DSLs". Regular expressions, sure,…

The random "ever done a CS degree?" is weird, and the premise that regular expressions are fundamental and mathematically general and therefore not a DSL is flawed: ebnf is also like that, and even more general. It _can_ parse HTML. Doesn't stop it from being an arbitrary representation of abstract syntax patterns. It's a DSL through and though and so is Regex. Actually pretty hard to find that pure of a DSL, which s…

Well, I remember them teaching that stuff, and regex is quite clearly a very different sort of DSL than the ones being discussed. That combined with the comment author's seeming lack of nuance made me wonder if they'd ever looked deeper than "all things without a for loop are a DSL". I think we are getting too far into the semantics here though, at risk of splitting hairs and geting lost in the details. The core point is that the article is talking about some quite specific types of DSLs, so you can't say respond with "No, DSLs are useful" and then list off a bunch of unrelated stuff as a rebuttal.
Post reply on HN