From: "Mauricio Fernández" Date: 2003-05-20T15:20:17+09:00 Subject: Re: public/protected/private syntax On Tue, May 20, 2003 at 06:08:35AM +0900, Robert wrote: > > we could then have anonymous method definitions too. Regular methods > > return a symbol, and anonymous methods return an UnboundMethod > > > > private def fred > > ... > > end > > > > dave = def(a,b) > > a + b > > end > > > > This would be a step towards rationalizing the proc/method issue. Then the only differences between anonymous methods and procs would be the argument passing semantics and the fact that a method needs to be bound, am I right? Will we want to keep both "yield" and "method" semantics forever, or will say "yield" be phased out? What about UnboundMethod instances passed as blocks being automatically bound to self on #call or yield? class Foo def do(*args) yield(*args) end def bar puts "Foo#bar" end end f = def; bar end Foo.new.do f # => Foo#bar Maybe it's not such a good idea because we'd have to document the expected arg. semantics for each method receiving a block... > Maybe an alternative to the UnboundMethod instance (if that's too expensive) > would be an object id of the would be created UnboundMethod instance that > could be used to retrieve the instance if needed. But then, what exactly > might be the operatons we want to perform with an anonymous method - apart > from invoking it? arity ? -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Actually, typing random strings in the Finder does the equivalent of filename completion. -- Discussion on file completion vs. the Mac Finder