From: Joshua Ballanco Date: 2011-10-19T00:14:13+09:00 Subject: [ruby-core:40207] Re: [Ruby 2.0 - Feature #5454] keyword arguments --20cf303b40cf0222f904af942d33 Content-Type: text/plain; charset=UTF-8 On Tue, Oct 18, 2011 at 1:33 AM, Haase, Konstantin < Konstantin.Haase@student.hpi.uni-potsdam.de> wrote: > Also, these are really named arguments in a Python sense, not keyword > arguments in a Smalltalk sense. > I just wanted to point out that MacRuby (in order to support compatibility with Obj-C which uses Smalltalk style keyword arguments) already uses the hash syntax for defining/calling methods, but the semantics are different from what is being proposed here, if I understand correctly. To summarize: # Ruby 2.0 proposal: def foo(a: 1, b: 2, c: 3) puts [a, b, c] end foo(a: 'one', b: 'two', c: 'three') #=> ["one", "two", "three"] # Currently in MacRuby: def foo(a: first, b: second, c: third) puts [first, second, third] end foo(a: 'one', b: 'two', c: 'three') #=> ["one", "two", "three"] With the current proposal for keyword arguments, I think MacRuby would not be able to implement this feature. --20cf303b40cf0222f904af942d33 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Oct 18, 2011 at 1:33 AM, Haase, Konstant= in <Konstantin.Haase@student.hpi.uni-potsdam.de> wro= te:
Also, these are really named arguments in a= Python sense, not keyword arguments in a Smalltalk sense.

I just wanted to point out that MacRuby (in order to su= pport compatibility with Obj-C which uses Smalltalk style keyword arguments= ) already uses the hash syntax for defining/calling methods, but the semant= ics are different from what is being proposed here, if I understand correct= ly. To summarize:

=C2=A0 =C2=A0 # Ruby 2.0 proposal:
=C2=A0 =C2= =A0 def foo(a: 1, b: 2, c: 3)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 puts [a= , b, c]
=C2=A0 =C2=A0 end
=C2=A0 =C2=A0 foo(a: 'one= ', b: 'two', c: 'three') #=3D> ["one", &qu= ot;two", "three"]

=C2=A0 =C2=A0 # Currently in MacRuby:
=C2=A0 = =C2=A0 def foo(a: first, b: second, c: third)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 puts [first, second, third]
=C2=A0 =C2=A0 end
=C2=A0 =C2=A0 foo(a: 'one', b: 'two', c: 'three&= #39;) #=3D> ["one", "two", "three"]

With the current proposal for keyword arguments, = I think MacRuby would not be able to implement this feature.
--20cf303b40cf0222f904af942d33--