From: Christophe Grandsire Date: 2005-10-29T04:49:41+09:00 Subject: Re: "Readability" inflation Selon Karl von Laudermann : > > I admit I haven't read all of the posts in the named parameter threads, > so I apologize if my question is answered there, but why does there > even need to be a new syntax for declaring methods with named > parameters at all? My first thought as to what "adding named > parameters to Ruby" means is that *any* method can be called using > named parameters or not. I.e., given a method: > > def foo(a, b) > a + b > end > > It can be called in any of these ways: > > foo(5, 3) > foo(a=5, b=3) > foo(b=3, a=5) > > Why can't this be made to work? > Because "a=5" is an expression that returns a value, and is thus allowed as an argument. That would create an ambiguity between "a=5" as an expression whose return value is used as argument and "a=5" as a named argument receiving a value. Anyway, quite a few people, including myself, don't like the idea of all arguments being optionally named arguments. It obliges method arguments to be part of the method interface, and that should only happen *when the developer explicitly wants it that way.* I know it's a feature of Python, and maybe it hasn't brought anything bad to it. However, it's one of the reasons why I quit learning the language. It wasn't the only syntax feature I disliked, but it didn't balance things out either. -- Christophe Grandsire. http://rainbow.conlang.free.fr You need a straight mind to invent a twisted conlang.