From: Joel VanderWerf Date: 2006-04-11T10:19:58+09:00 Subject: Re: Class Definition inside a method definition? dblack@wobblini.net wrote: > Hi -- > > On Tue, 11 Apr 2006, Bihal wrote: > >> Thanks David. I'm not sure you caught sight of the line of code I was >> worried about. I should have made it more clear. This one in particular >> >> sclass = class << self; self; end >> >> does use a class keyword and syntactic construct, it's just on a single >> line. > > Oh. So it does. Well, I guess those are allowed, then :-) I'm not > sure what the rationale is. I wonder if it has something to do with > the realm of constants, compile-time resolution, etc., or just the > theory that class << obj isn't of much use if you can't use it > dynamically in methods. Maybe it is allowed for consistency with the fact that the 'def obj.meth' form is allowed in that context. def foo x = [] def x.bar "bar" end puts x.bar end foo -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407