From: Charles D Hixson Date: 2002-01-20T04:51:23+09:00 Subject: Re: Proc.class vs yield : propose keyword procs 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. -- Charles Hixson Copy software legally, the GNU way! Use GNU software, and legally make and share copies of software. See: http://www.gnu.org http://www.redhat.com http://www.linux-mandrake.com http://www.calderasystems.com http://www.linuxapps.com