From: Michael Lucas-Smith Date: 2002-01-20T18:33:52+09:00 Subject: Re: Proc.class vs yield : propose keyword procs Charles D Hixson wrote: > On Friday 18 January 2002 15:59, you wrote: > >>That's a slippery slope to smalltalk ;-). I suppose you could if >>you were required to give an empty arglist like [|| ...] when >>there weren't any arguments so there would be no confusion with >>an Array literal. But if you were going to change the language >>why not only allow one of the two currently allowed syntaxes for >>a block ({|| ...}, or do || ... end), and use the other to >>instantiate an actual Proc object (and I'm not necessarily >>advocating this, but it might add more visual distinction). The >>best I can offer you is a band-aid, lambda instead of proc (a >>much nicer word don't you think?). >> >>Alexander Schofield >> >>Michael Lucas-Smith wrote: >> >>>I see what you're saying. I suggest that perhaps it was a >>>mistake to re-use the same syntax between hash and block. >>>Obviously that cannot be fixed now, but perhaps [] can be used >>>to represent a proc so that: >>> >>>proc { ... } >>>and: >>>[ ... ] >>> >>>mean the same thing. >>> >>>Michael >>> > Possibly a new reserved word: procs > The meaning would be that all of the remaining arguments were > procs. Thus: > def method (procs a, b, c) > > This would be in error if, e.g., c were not a proc, and one could > also have > def method (some, bunch, of, arguments, procs a, b, c) > > There is a question in my mind as to whether or not one should be > able to specify an indefinite number of procedure arguments, but I > don't see how one could have both multiple procedure agruments and > an indefinite number of non-procedural arguments. I don't see why > one would want to, but perhaps one should plan for the necessity. > In that case the syntax would change to: > def method (some, arguments) procs (a, b, c) > > This could get messy if one were using in-line code rather than > procedure variables, but that's more the fault of the in-line code > than anything else. > > Sorry, I don't see any use to this. That's adding typing information to parameters of a method. That's like specifying you want the first two arguments to be strings, the next argument to be an integer and the last three arguments to be procs. Michael