Re: A12: Required Named Parameters Strike Back!

2004-05-06 Thread Dov Wasserman
"Larry Wall" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > On Wed, May 05, 2004 at 04:25:45PM -0400, Austin Hastings wrote: > : > : method x ($me: $req, ?$opt, +$namedopt, *%named, [EMAIL PROTECTED]) {...} > : vs: > : method x($me: $req, ?$opt, ~$namedopt, *%named, [EMA

Re: A12: Required Named Parameters Strike Back!

2004-05-05 Thread Abhijit A. Mahabal
On Wed, 5 May 2004, John Siracusa wrote: > Anyway, once we're spelling things out, don't forget to throw in some > traits for params that are required and must be provided as pairs. > Damian promised! ;) Looking thru what exists of P6C I saw this in P6C/Nodes.pm: use Class::Struct P6C::signatur

Re: A12: Required Named Parameters Strike Back!

2004-05-05 Thread John Siracusa
On 5/5/04 6:24 PM, Austin Hastings wrote: > To answer Dan's posting: I fully expect to never use any of these > sigils, myself. I'm sure there will be traits for this- nice > verbose traits. (Signatures are about as write-once as you can get...) > > method x( > requires:invocant $me, > require

Re: A12: Required Named Parameters Strike Back!

2004-05-05 Thread Dan Sugalski
At 1:55 PM -0700 5/5/04, Larry Wall wrote: On Wed, May 05, 2004 at 04:25:45PM -0400, Austin Hastings wrote: : In this case, the reliance on saying: : : if (+$x > 9) ... : : to disambiguate logical/arithmetic/string/whatever context in expressions is : going to sit at cross purposes to the +-a

Re: A12: Required Named Parameters Strike Back!

2004-05-05 Thread Larry Wall
On Wed, May 05, 2004 at 04:25:45PM -0400, Austin Hastings wrote: : In this case, the reliance on saying: : : if (+$x > 9) ... : : to disambiguate logical/arithmetic/string/whatever context in expressions is : going to sit at cross purposes to the +-as-required-arg usage. It'll be yet : anot

RE: A12: Required Named Parameters Strike Back!

2004-05-05 Thread Austin Hastings
> -Original Message- > From: Larry Wall [mailto:[EMAIL PROTECTED] > > On Wed, May 05, 2004 at 09:02:14AM -0500, Jonathan Scott Duff wrote: > : > Hmm... I'm quite sure that I like ~ better than + for mnemonic purposes. > : > : I agree. > > I think + is easier to see. Mnemonic value is a sec

Re: A12: Required Named Parameters Strike Back!

2004-05-05 Thread Larry Wall
On Wed, May 05, 2004 at 09:02:14AM -0500, Jonathan Scott Duff wrote: : > Hmm... I'm quite sure that I like ~ better than + for mnemonic purposes. : : I agree. I think + is easier to see. Mnemonic value is a secondary issue in something that will be used so heavily. Larry

Re: A12: Required Named Parameters Strike Back!

2004-05-05 Thread Jonathan Scott Duff
On Tue, May 04, 2004 at 04:14:44PM -0600, Luke Palmer wrote: > Dov Wasserman writes: > > Since in the rest of Perl 6, the '~' operator involves string > > representation, perhaps the standard +$foo marker should really be ~$foo: > > i.e., $foo only has a (string) name, not a numeric position. Thus

Re: A12: Required Named Parameters Strike Back!

2004-05-04 Thread Luke Palmer
Dov Wasserman writes: > Long-time lurker, first time poster. Dittos, kudos, etc. Welcome aboard. > Since in the rest of Perl 6, the '~' operator involves string > representation, perhaps the standard +$foo marker should really be ~$foo: > i.e., $foo only has a (string) name, not a numeric positio

Re: A12: Required Named Parameters Strike Back!

2004-05-04 Thread Dov Wasserman
Long-time lurker, first time poster. Dittos, kudos, etc. Back on the topic of required named parameters, I think John Siracusa's initial post did a good job of separating the two concepts of parameter mandate (required vs. optional) and parameter designation (by position vs. by name). Each of thes

Re: A12: Required Named Parameters Strike Back!

2004-04-22 Thread John Siracusa
On 4/22/04 6:52 PM, John Siracusa wrote: > Yes, it appears that runtime checks for the existence of required params > will continue to be a necessary part of Perl programming. ...of course, there are at least two ways to do "runtime checks": * runtime checks that the programmer has to write h

Re: A12: Required Named Parameters Strike Back!

2004-04-22 Thread John Siracusa
On 4/22/04 5:33 PM, Aaron Sherman wrote: > On Tue, 2004-04-20 at 10:51, John Siracusa wrote: >> Hm, so how would the "is required" trait that Damian posted work? Would it >> simply be shorthand for a run-time check that I don't have to write myself? >> I was under the impression that it would work

Re: A12: Required Named Parameters Strike Back!

2004-04-22 Thread Aaron Sherman
On Tue, 2004-04-20 at 10:51, John Siracusa wrote: > Hm, so how would the "is required" trait that Damian posted work? Would it > simply be shorthand for a run-time check that I don't have to write myself? > I was under the impression that it would work the way I described earlier: > > sub fo

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread Dan Sugalski
At 10:51 AM -0400 4/20/04, John Siracusa wrote: On 4/20/04 10:42 AM, Dan Sugalski wrote: At 9:50 AM -0400 4/20/04, John Siracusa wrote: On 4/19/04 7:16 PM, Larry Wall wrote: Well, no, we're still stuck at run-time validation of that. In the case of methods you can't really do anything else an

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread John Siracusa
On 4/20/04 10:42 AM, Dan Sugalski wrote: > At 9:50 AM -0400 4/20/04, John Siracusa wrote: >> On 4/19/04 7:16 PM, Larry Wall wrote: >>> Well, no, we're still stuck at run-time validation of that. In the case >>> of methods you can't really do anything else anyway, generally speaking. >> >> Why is

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread Dan Sugalski
At 9:50 AM -0400 4/20/04, John Siracusa wrote: On 4/19/04 7:16 PM, Larry Wall wrote: > Well, no, we're still stuck at run-time validation of that. In the case of methods you can't really do anything else anyway, generally speaking. Why is that? Because at compile time all you have is a generic t

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread John Siracusa
On 4/19/04 9:05 PM, Damian Conway wrote: > You want: > > sub foo(+$a is required, +$b is required) { ... } Yes, that would be just fine :) -John

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread John Siracusa
On 4/19/04 7:16 PM, Larry Wall wrote: > On Mon, Apr 19, 2004 at 01:44:53PM -0400, John Siracusa wrote: > : ...named and required, or named and optional? IOW, is this all true? > : > : sub foo(+$a, +$b) { ... } > : > : foo(); # compile-time error! > : foo(1, 2); # compil

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread Damian Conway
John Siracusa asked: Well, actually, we saved you last summer when we decided to make + mean that the parameter must be named. ...named and required, or named and optional? Named and optional, by default. IOW, is this all true? sub foo(+$a, +$b) { ... } foo(); # compile-time e

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread Larry Wall
On Mon, Apr 19, 2004 at 01:44:53PM -0400, John Siracusa wrote: : On 4/19/04 1:30 PM, Larry Wall wrote: : > On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote: : > : I know we are running out of special characters, but I really, really think : > : that required named parameters are a natu

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread Dan Sugalski
At 1:50 PM -0400 4/19/04, John Siracusa wrote: On 4/19/04 1:41 PM, Dan Sugalski wrote: At 1:14 PM -0400 4/19/04, John Siracusa wrote: I know we are running out of special characters, but I really, really think that required named parameters are a natural fit for many common APIs. Well... maybe,

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread John Siracusa
On 4/19/04 1:41 PM, Dan Sugalski wrote: > At 1:14 PM -0400 4/19/04, John Siracusa wrote: >> I know we are running out of special characters, but I really, really think >> that required named parameters are a natural fit for many common APIs. > > Well... maybe, but ponder a likely common case--auto

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread Jonathan Scott Duff
On Mon, Apr 19, 2004 at 10:30:18AM -0700, Larry Wall wrote: > On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote: > : I know we are running out of special characters, but I really, really think > : that required named parameters are a natural fit for many common APIs. A12 > : has reinfo

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread John Siracusa
On 4/19/04 1:30 PM, Larry Wall wrote: > On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote: > : I know we are running out of special characters, but I really, really think > : that required named parameters are a natural fit for many common APIs. A12 > : has reinforced that belief. Sav

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread Dan Sugalski
At 1:14 PM -0400 4/19/04, John Siracusa wrote: I know we are running out of special characters, but I really, really think that required named parameters are a natural fit for many common APIs. Well... maybe, but ponder a likely common case--automatically redelegated initialization methods with cl

Re: A12: Required Named Parameters Strike Back!

2004-04-19 Thread Larry Wall
On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote: : I know we are running out of special characters, but I really, really think : that required named parameters are a natural fit for many common APIs. A12 : has reinforced that belief. Save me, Dami-Wan Wallnobi, you're my only : hope