Hacker News new | ask | show | jobs
by valw 4187 days ago
Would you agree to call Grunt a configuration tool?

I have found the fact that Grunt lets you write full-featured JavaScript quite useful. In 95% of cases, of course, you want to write your configuration in a declarative, JSON-like form, but I welcome the possibility of having full JS power in the few situations where non-trivial logic is needed. Another advantage, of course, is familiarity: I already know JavaScript.

However, what I really don't like is a declarative data language or some sort of DSL that starts adding some basic variable and control flow features. That's the best way to end up with a tool that's complicated, hard to reason about, and still unexpressive.

So to me, a good configuration language should be either a simple data language (such JSON), OR a simple, powerful, well-known programming language with good data structure literals to encourage a declarative style.

1 comments

Certainly, but personally I would still like to keep logic out of configuration as much as possible.

If I had to pick an actual language for configuration I would probably pick Javascript, mostly because I like JSON's syntax.

My instinct would be to say that if you need non-trivial logic, you may have an issue elsewhere with separation of concerns, and should move that code somewhere else.

But I will concede there may be a cases I'm just not aware of where that's unavoidable. Almost everything I do involves json or ini files anyway so I haven't really worked on anything incredibly complex.

My first and biggest issue with computation in configuration files is the moment you need to / want to manage that configuration with a tool.

In 30+ years I've never come across a case where logic has been necessary in configuration beyond very simple branching / inclusion logic, if that.