On Oct 7, 2008, at 8:48 AM, James Gray wrote:

> I've wished Builder would go to something like the following in the  
> past, just to give me more choices when using it:
>
> http://blog.grayproductions.net/articles/dsl_block_styles

Good post!  I especially like the thought that sometimes "pretty  
syntax" trumps a reluctance to use instance_eval.  When doing a DSL  
for (primarily) non-programmers, I have no problems going the  
instance_eval route.  When writing a library to be used by  
programmers, I prefer straightforward semantics that can easily  
reasoned about.

Regarding the "check the arity" suggestion, I would like to point out  
that the following is not uncommon in builder:

     xml_builder = Builder::XmlMarkup.new
     xml_builder.div { |x|
       x.p {
         x.em("HI")
       }
     }

The outer block uses the |x| form to get an abbreviated alias to the  
xml_builder variable.  The inner blocks don't repeat the block  
argument.  If I did arity sensing, we would be switching back and  
forth between instance_eval'ed and non-instance_eval'ed code.

-- 
-- Jim Weirich
-- jim.weirich / gmail.com