On Wed, 07 Aug 2002 02:37:30 +0200, Justin Johnson wrote:


> I was having look at another language called ElastiC, which is a pretty
> cool language.  As far as I can tell its named method calls are similar
> to Smalltalks and especially similar (identical?) to Objective-C.
> [obj height: 20 width: 40 name: "foo" ]
> But the interesting thing to note is that there is no method name
> specified. The method is selected based on the argument names.

This is not totally true: in the example you made above, there *is* a method
name and it's "height:width:name:". Actually, I should say that the
*method signature* is "height:width:name:". The method is selected
based on this signature, not on the "argument names" (even if, from
a reader's point of view, this is equivalent to having named arguments).

> obj( height: 10, width: 20, name: "foo" )
>     or
> obj height: 10, width: 20, name: "foo"

As I proposed in another post:

obj.height:10 width:20 name:"foo"

I don't know what changes to the parser this would require, though.
Objective-C's and Smalltalk's syntax could be used, but it would
interfere with Array literals.

> Being able to supply the parameters in any order just means that the
> programmer can make the program harder to read.  I think that's bad. 

I think that's EXTREMELY bad.

> Better:
>     obj( x: 10, y: 20, z: 30 )

In my view, commas and parenthesis could be eliminated and replaced
with dot and spaces, as I said above.

-- 
ste