3 ms·
Reminds me of the evolution of Lua https://www.lua.org/history.html https://www.lua.org/history.html from a configuration language to a full blown programming l
by hiker 9y ago
Reminds me of the evolution of Lua https://www.lua.org/history.html https://www.lua.org/history.html from a configuration language to a full blown programming language.
Awhile ago, we've used this code as data approach in a game development studio for everything. For example, maps/levels were stored as a Lua scripts that get executed on load and contain a sequence of PlaceObject, SetProperty, etc invocations.
It doesn't come without drawbacks, though. For example, Autodesk Maya stores scenes as Mel code (as a bunch of createNode, connectAttribute, setAttribute commands). This script gets executed on load in a single thread (utilizing a single from your N cores) and scene loading can take ~30 min on large scenes. Security is also an issue but it's fixable with proper environment sanitation and sandboxing.
- vog 9y agoThis 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 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.
- cup-of-tea 9y agoEmacs just used a full blown programming language right from the start. And one of the very best: Lisp.
- oblio 9y ago> And one of the very best: Lisp. Got any hard numbers to back up that bold claim?
- cup-of-tea 9y agoI rate it 10/10. What kind of numbers are you expecting exactly?
- oblio 9y agoAnything which can support the grandiose Lisper claims such as the one above :) By which measurable metric is Lisp "one of the best"? I'm genuinely curious, since I keep hearing propaganda about it.
- cup-of-tea 9y agoWhat programming languages do you use? What numbers made you choose those ones? Maybe if you show me an example of some numbers I could help more. I don't have the time to write up why I think Lisp is great, but you can find essays by many greater (and more famous) programmers than me such as Richard Stallman, Peter Norvig, Steve Yegge, Paul Graham et al. But really the only way is to learn it for yourself. There is a kind of enlightenment that comes with learning Lisp and I would recommend it to every programmer.
- willtim 9y agoWhat numbers do you require? If there was a metric measuring simplicity then Lisp (or perhaps a modern variant, Scheme) would probably win - it is a local optimum of language design, essentially just lambda calculus exposed via a very simple grammar (which aids meta-programming).
- oblio 9y agoAny kind of serious study will do :)