From: "T. Onoma" Date: 2004-08-23T07:42:03+09:00 Subject: Re: Callback for instance var creation? On Sunday 22 August 2004 06:15 pm, Florian Gross wrote: > T. Onoma wrote: > > Calling method(:ameth) doesn't work because it creates a new method > > object everytime and therefore looses state. Plus it is overly verbose. > > Oh, a cache could be added easily. Can't do anything about the verbosity > however. Yes, perhaps I will add a cache to method. Then I'll have three working implementations of this: 1. method(:ameth) # per above 2. :ameth[self] # modifies symbol class 3. Ameth() # using missing_method and capitalization The later is of course a take-off of the constant version (non-implementable) but in this case you have to use the parentheses. All of these, obviously, have their disadvantages. I think probably the best way to actually do this is to change how :: works. Currently it works like this: Foo.Bar() # method call Foo.Bar # method call Foo.bar() # method call Foo.bar # method call Foo::Bar() # method call Foo::Bar # constant lookup Foo::bar() # method call Foo::bar # method call I suggest this instead: Foo.Bar() # method call Foo.Bar # method call Foo.bar() # method call Foo.bar # method call Foo::Bar() # method call Foo::Bar # constant lookup Foo::bar() # method call Foo::bar # 1st class method The only shortcoming here is that capitalized methods can't be accessed this way b/c they interfere with constants. But that's very very minor point. With this in place you could easily access 1st class methods like this: ::ameth -- T.