From: Jeff Wood Date: 2005-10-20T08:52:00+09:00 Subject: Re: Method annotation and anonymous functions Of course, my use of '->' doesn't take into consideration the suggestions for new style syntax for blocks ->( a, b ) { ... } ... You've always done a great job with things, I guess I'm just suggesting another bit of punctuation that would state ( attribute of surrounding method ). j. On 10/19/05, Jeff Wood wrote: > Most languages define some token that specifically states method attribute... > Java uses @... since @ isn't a used char otherwise. > > for us ... it would need to be something else ... > > and it would simply bind to the function its declared in, just like > functions bind to the classes they are declared in. > > how 'bout > > def method1( a, b ) > ->visibility = true > ->returns = int > # actually do some work... > ... > end > > just thinking out loud... since it would have a new punctuation it > wouldn't introduce incompatibility. > > j. > > On 10/19/05, Yukihiro Matsumoto wrote: > > Hi, > > > > In message "Re: Method annotation and anonymous functions" > > on Thu, 20 Oct 2005 03:26:49 +0900, stevetuckner writes: > > > > |Anonymous functions: > > | > > |x = def (a=1,b=2) { ... } > > |y = def(a,b=3) begin > > | ..... > > |end > > > > Probably I will not use "def" for anonymous function, because there > > are tow major differences in def statement and anonymous def above: > > > > * def statement defines new name for a method, anonymous def does > > not define any name. > > > > * besides that, def statement introduces a whole new scope, > > anonymous def should be a closure, that allows access to external > > local variables. > > > > |Annotated functions: > > | > > |class A > > | def foo(a, b) > > | .visibility :private # how can this be parsed? (the above > > |line has no trailing marker to signal it as one expression > > | .returns Integer > > | begin > > | .... > > | end > > > > This is a too big syntactic incompatibility. > > > > matz. > > > > > > > -- > "http://ruby-lang.org -- do you ruby?" > > Jeff Wood > > -- "http://ruby-lang.org -- do you ruby?" Jeff Wood