From: Pit Capitain Date: 2008-10-02T04:40:05+09:00 Subject: Re: ruby1.9 block scope 2008/10/1 Mike Gold : > Daniel DeLorme wrote: >> Yes, I would love to see some non-contrived example code. I don't use >> define_method very often and I have hardly ever used Class.new, >> certainly not with several levels of nested blocks. The common case for >> which I *would* like to use this suggested featured is something like >> this: > > Because you've hardly ever used Class.new, and therefore are probably > not familiar with run-time generated classes which present a given > binding as different views to external onlookers, then you won't > appreciate what I have to say. So Mike, please show us a real non-contrived example to enlighten us. I've often used Class.new but still don't see your problem. > In fact I think my example does suffice. No it doesn't. In your example there's no obvious need to use Class.new and define_method. >> Far from a monster of O(n^2) complexity, > > It is O(n^2) complex because it requires a backtrack for each case. I > like to be certain what code does. I will always backtrack in order to > be certain. You have to do that in current Ruby, too, because you have to check for local variables that have been assigned to before the code blocks. Expanding the checks to the end of the scope doesn't change the O complexity. Regards, Pit