I can't read this as anything more insightful than functions are also an extremely powerful tool when it comes to building APIs. I first used Ruby in 2000. What am I missing?
Nothing. The emphasis on DSLs is distracting.
Worse, it may lead people to think that certain coding techniques are only used when creating a "DSL".
foo do
bar do
..
end
baz 123
end
now try to do the same with some other language which supports something-kind-of-like-ruby-blocks but with a different syntax. it will not look nearly as good, so in those languages instead of creating DSL people usually implement some kind of config file format instead. or just use XML :)if you'd have to use 'lambda' to define a block for example, it would make a much worse DSL with lots of extra syntax noise.
> ... instead of creating DSL people usually implement some kind of config file format instead. or just use XML.
Writing a grammar or a parser means you haven't created a DSL?
Unless by "DSL" you mean "Ruby syntax and Ruby semantics with symbol names chosen by the programmer", I have no idea what you mean by "DSL".
Ruby's syntactic flexibility and semantic model mean that many cases handled by a change to the language spec or delegating to another language (XML config files, for example) can be cleanly handled in Ruby itself. The end result is often something that looks like a little language for a specific task, such as Rake, Rails, etc. (I'm not a Ruby programmer, so I hope those are good examples.)
So with Ruby, there are very few cases where writing a custom grammar or parser is necessary. Ruby's flexibility gives you the ability to do things that might require a custom grammar or parser in other languages.
I think Piers Cawley was dead on by calling things like this a Pidgin
refs:
* http://www.infoq.com/interviews/jim-weirich-discusses-rake