Charles Nutter has a great blog entry on a Bytecode DSL written in JRuby. If you look closely at the code, he's making great use of Ruby's blocks. It makes the code succint and powerful. Oh yeah, it's fun, too! The example could be done in any dynamic language with closures (Groovy for example).
I'm loving the examples of DSLs coming out of the Ruby community right now. They show off the expressive power of method_missing and blocks (or doesNotUnderstand: in Smalltalk). There's a lot of power in those two simple features that allow you to express higher level concepts easily.
Subscribe to:
Post Comments (Atom)
2 comments:
"The example could be done in any dynamic language with closures"
Could the example be done in any statically type checked language with closures?
Yes. You can do anything in a statically typed language that you do in a dynamically typed one. You'll just type more (no pun intended).
Post a Comment