From: Daniel Schierbeck Date: 2005-11-18T22:12:18+09:00 Subject: Re: Keyword arguments like grandma makes 'em Christophe Grandsire wrote: > Selon Daniel Schierbeck : > >> The reason I think symbols are appropriate as keys when calling a method >> with named parameters is that I believe symbols are *names*. Names of >> method, variables, attributes, etc. So when I type `foo :bar => "baz"', >> I'm calling the method `foo', setting the parameter named `bar' to the >> value of `baz' (even though I think the `=>' operator actually means >> "points to"). >> >> This won't disallow for Matz' `foo bar: "baz"' style. Actually, I think >> the `key: value' should be added as a generic way of writing key/value >> pairs in a hash, where the key is a symbol (that seems to become the >> norm). These should mean the same: >> >> connect :to => "example.com" >> connect to: "example.com" >> >> And a normal hash: >> >> {a: "foo", b: "bar", c: "baz"} >> -> {:a => "foo", :b => "bar", :c => "baz"} >> > > You don't need the "should". This very hash syntax has already been adopted for > Ruby2 (http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l4). And I bet it > influenced the current proposed syntax for named parameters. You can > immediately begin using methods that use hash arguments with the new syntax, > and then slowly refactor to use true named parameters, without having the > syntax changed. > -- > Christophe Grandsire. > > http://rainbow.conlang.free.fr > > It takes a straight mind to create a twisted conlang. > > Jolly-good then!