From: TRANS Date: 2007-07-09T23:29:14+09:00 Subject: Re: GetoptLong w/ DSL On 7/9/07, Nobuyoshi Nakada wrote: > Hi, > > At Sun, 8 Jul 2007 22:35:10 +0900, > TRANS wrote in [ruby-core:11617]: > > > > On 7/8/07, nobu@ruby-lang.org wrote: > > > > > You can't change the object which is the subject of instance > > > variables. > > > > what? > > An artificial example: > > @flags = [:help, :h] > GetoptLong.new do > flag *@flags > required :name > end Ah, I see. Yea, one would just have to know that it's an instance_eval block by documentation. > Well, maybe, I should have write as "against overdoing by > hidden instance_eval". But I'm still doubtful that "DSL" is > standard by default. > > It can't be a separated library? Sure, it can. Indeed, my first implementation was as a subclass of GetoptLong. But being such a small bit of code that doesn't cause backward incompatibility, and results (IMHO) in code that's easier to read and more convenient to write, it seemed like a good addition to GetoptLong itself. But I'm curious. DSLs seem to be one of the great strengths of Ruby. Why shun them in standard library? Thanks, T.