3 ms·
That's cool, but this isn't about Ruby. Racket is a different language, and the lessons you've learned from Ruby don't apply there.
by mkozlows 11y ago
That's cool, but this isn't about Ruby. Racket is a different language, and the lessons you've learned from Ruby don't apply there.
- vinceguidry 11y agoMeta-programming is meta-programming, whether your language makes it easier to use or not doesn't change what it is. Playing with the syntax of a language forces you to have to maintain it yourself and creates a burden on anyone else who has to read your code. Same whether it's Ruby, C, or a Lisp dialect. Our minds can only handle so much abstraction at once, and meta-programming introduces a completely new level often without warning. Even going back and reading your own code can be a chore unless you take the time to carefully design your language extensions and set up workflows for debugging through them. The design / workflows need to be re-understood every time you touch the code. I am aware of Lisp supermen that no longer code like mere mortals, but rather in a dizzying edifice of macro expansions. It impresses me only as a technique for acquiring job security, and is only mildly more impressive than getting an employer to agree to Lisp in the first place.
- sklogic 11y ago> Playing with the syntax of a language forces you to have to maintain it yourself and creates a burden on anyone else who has to read your code. You're doing it wrong. eDSLs are designed to simplify the code and make it easier to read it and maintain it. If it is not your case, then you did not design your eDSLs properly. > Our minds can only handle so much abstraction at once, Our minds can operate with a very limited set of entities at once. Abstractions are absolutely essential for reducing complexity. Of course you must stay on a same level of abstraction, and you cannot really do it without metaprogramming. You can design a nice, clean DSL which only deals with the problem domain level of abstraction, does not expose anything irrelevant from your host language. Without this all your abstractions are leaky, and you'll see the host language peculiarities through your problem domain, making it harder to grasp all at once.
- vinceguidry 11y agoA DSL is something you have to design and maintain. The simplifications do not come free. Things leak through DSLs all the time, it's not a magic bullet. I've made and ripped out a bunch of DSLs, now it's a tool I only reach for if there's a clear need for it.
- sklogic 11y agoDesigning DSLs is cheap and easy if you have a proper metaprogramming. It is as simple as picking up a number of language features from your toolbox and mixing them together in a simple, declarative way. Maintaining DSLs is also much, much easier than maintaining essentially the same thing, but mutilated and spread in thousands lines of application code, mixed with a number of lower and higher levels of abstraction. > now it's a tool I only reach for if there's a clear need for it. There is almost always a need for a DSL. Pretty much any problem is better solved with a DSL, as long as it's something more complex than a "Hello, world".
- kd0amg 11y agoMeta-programming is meta-programming, whether your language makes it easier to use or not doesn't change what it is. Not really. What Rubyists call "meta-programming" is not what Lispers call "meta-programming." Things like mutating already-existing classes and asking an object what methods it has do not belong in the same category as syntactic abstraction (except maybe if you're programming in Kernel). That they have both been labeled "meta-programming" by their respective practitioners is just a historic accident.