T
trans. (T. Onoma)
Hi --
 foo.methods[:new, rotected]  # if you need combination
This line's got me thinking... How does one define a class []
constructor? For example Hash can be use like this:
Hash[:a=>1,:b=>2 ]
class C
def C.[](...)
...
end
end
Duh! Thanks, I don't know why I thought there was something special about it.
You can define such methods; for example, there's Integer. A number
of people (including me aren't big fans of method names that begin
with uppercase letters, but it can be done.
Right. Well then, I must propose that all such class names be constructor
methods too. No sense in confusing things otherwise. By default:
def AClass(*args, &blk)
AClass.new(*args, &blk)
end
But for something like Hash, it would be defined like Hash[].
MHO,
T.
P.S. Okay, this is where you tell me why this is a bad idea