Hacker News new | ask | show | jobs
by vog 3092 days ago
This is an interesting aspect, but slightly different from what I had in mind.

Just because you treat data as code doesn't mean you have to force it into a Turing-complete language. It just means that you should document it, format it properly, put it into version control and deliver it for deployment.

Moreover, Turing-complete languages are more of an anti-pattern here. The proper design pattern here is the Rule of Least Power:

https://en.wikipedia.org/wiki/Rule_of_least_power

It means you should choose the least powerful language suitable for a given purpose.

And this is where DSLs or "data as code" can play its advantages: Not just makes it things shorter and simpler, but you can also force it into a less powerful language, which allows you to eradicate certain types of bugs and security issues by not making them even expressible anymore. Moreover, you can run your data structure through different "interpreters" doing different things with it, which is completely inpractical of your data structure describes a too powerful language.