Ruby, DSLs and the free lunch that was not so free

By  

5 – the brain hurt of the meta-programmer

When XML came along, lot of folks thought it was a new thing in the world. A small coterie of folks, generally with notable flecks of gray in their hair, knew about its familial relationship to SGML and GML before that. To this day, a lot of folks find XML a bridge too far. The level of abstraction it uses – one step above a normal language – moves it beyond the pale for many people.

Now, as Ruby DSLs come along, lot of folks appear to think it is a new thing in the world. A small coterie of folks, generally with very notable flecks of gray in their hair, know about its familial relationship with Lisp and in particular the Lisp macro system and can be traced back at least to the Sixties. Lisp evangelists (a wonderfully persistent group of people) often argue that Ruby's DSLs are limited in comparison to what 1960's Lisp could do but I digress... To this day, a lot of folks find the concepts in Lisp macros to be a bridge too far. The level of abstraction it uses – one step above a normal language – moves it beyond the pale for many people.

Conclusion

As soon as language goes "meta" it crosses a rubicon. History has shown that introducing meta-linguistics into computing – however beneficial – is no easy matter. Furthermore, it seems to me that we are already absolutely swimming in DSLs. Every GUI tool that auto-generates "low level" code from a UML model, or allows you to drag-n-drop a relational data mapping or click'n'drag an event handler onto a form...DSL's everywhere.

So what exactly would Ruby DSLs do differently? I think it boils down to this. Ruby – just like Lisp macros before it – provide text-editable access to the high level sentential forms. i.e. you don't need to run a custom GUI to create your domain specific sentential forms, you can just type them into vi or emacs or notepad or whatever.

DSLs – in the pure sense of a meta-language you can type into a plain old text editor – have been around for a long long time and have had quite limited success if you define success in terms of mass market uptake. On the other hand, GUIs that allow you to work in high level sentential forms and generate the low level sentential forms seem to be going from strength to strength. Is that trend going to change? I don't think so. If anything, I think it will accelerate.

As I said earlier, I am a language-oriented IT person and I value the bits-on-the-wire syntax greatly. Statistically speaking, I am very likely to use a tool like Lisp macros or a Ruby DSL because it corresponds to how I think. However, I don't consider myself in any way representative of the mass of programmers on the planet. I'm too fond of the very concept of language for that.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Ask a Question