Re: E6 question

2003-08-03 Thread John Siracusa
On 8/1/03 11:44 AM, Mark J. Reed wrote:
 Is it possible with the new parameter declaration syntax to declare
 a mandatory name-only parameter?

My earlier plea for this feature begins here:

http://archive.develooper.com/[EMAIL PROTECTED]/msg14666.html

I didn't think I made much headway, but this...

On 8/1/03 5:52 PM, Damian Conway wrote:
 Probably.

...is encouraging :)

 I think that the '?', '*', and '+ prefixes are abbreviations for
 traits (Cis optional, Cis List, Cis optional is named). So
 a named, mandatory parameter would be:
 
 sub foo($bar is named) {...}

Good, but a single-letter prefix would also be nice :)

 Alternatively, you could just specify a mandatory parameter that has to be a
 Pair:
 
 sub foo(Pair $bar) {...}
 
 (though then you'd have to use C$bar.value for the value).

Ick.

-John



E6 question

2003-08-01 Thread Mark J. Reed
Is it possible with the new parameter declaration syntax to declare
a mandatory name-only parameter?

-Mark


Re: E6 question

2003-08-01 Thread Luke Palmer
 Is it possible with the new parameter declaration syntax to declare
 a mandatory name-only parameter?

Not directly, no.  However, some trickyness with macros would probably
let you do it.  I don't yet understand macros well enough to show
you...

Luke

 Mark


Re: E6 question

2003-08-01 Thread Damian Conway
Mark J. Reed wrote:

Is it possible with the new parameter declaration syntax to declare
a mandatory name-only parameter?
Probably. I think that the '?', '*', and '+ prefixes are abbreviations for 
traits (Cis optional, Cis List, Cis optional is named). So a named, 
mandatory parameter would be:

	sub foo($bar is named) {...}

Alternatively, you could just specify a mandatory parameter that has to be a Pair:

	sub foo(Pair $bar) {...}

(though then you'd have to use C$bar.value for the value).

Damian