Re: Hoping that Params::Validate is not needed in Perl6

2005-08-18 Thread Yuval Kogman
On Wed, Aug 17, 2005 at 23:43:43 -0500, Dave Rolsky wrote: But I'd really like to get this stuff done at compile time wherever possible. If I write this: validate( credit_card_number: $number ); it should blow up at compile time, right? So should MMD: The type signatures are

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-18 Thread Larry Wall
On Thu, Aug 18, 2005 at 11:03:22AM -0500, Dave Rolsky wrote: : Hurry up and finish. I want to use this language, darnit! And yes, I : know about pugs, obviously, but for production usage I need less of a : moving target ;) Yes, Perl 6 is a moving target--but one of the most bothersome facts

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-18 Thread chromatic
On Wed, 2005-08-17 at 23:43 -0500, Dave Rolsky wrote: But I'd really like to get this stuff done at compile time wherever possible. If I write this: validate( credit_card_number: $number ); it should blow up at compile time, right? Does that depend on how closed you want Perl 6 to

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 10:02:23AM -0700, chromatic wrote: On Wed, 2005-08-17 at 23:43 -0500, Dave Rolsky wrote: But I'd really like to get this stuff done at compile time wherever possible. If I write this: validate( credit_card_number: $number ); BTW, the colon is on the left:

Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
One of the things I'm looking forward to in Perl6 is greatly improved sub/method signatures. I'm hoping that this will eliminate the need for anything like Params::Validate, which IMO is a nasty hack to make up for a serious weakness in Perl5. I'm going to go over the various features in

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Uri Guttman
DR == Dave Rolsky [EMAIL PROTECTED] writes: DR Mandatory vs. Optional Parameters DR This is a pretty straightforward one in P6, I think. Parameters can DR be marked as required with is required like this: DR sub date ($year, ?$month, ?$day) # positional DR sub date (+$year is

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Luke Palmer
On 8/17/05, Dave Rolsky [EMAIL PROTECTED] wrote: I'm going to go over the various features in P::V and see if there are equivalents in Perl6, and bring up any questions I have. I think this will be interesting for folks still new to P6 (like myself) and existing P::V users (I think there's a

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Yuval Kogman
On Wed, Aug 17, 2005 at 22:06:07 +, Luke Palmer wrote: { credit_card_number = { optional = 1, depends = [ 'credit_card_expiration', 'credit_card_holder_name' ] }, credit_card_expiration = { optional = 1 }, credit_card_holder_name = { optional = 1 },

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
On Wed, 17 Aug 2005, Luke Palmer wrote: Dependencies, Exclusions, and Require one-of With P::V I can do this: { credit_card_number = { optional = 1, depends = [ 'credit_card_expiration', 'credit_card_holder_name' ] }, credit_card_expiration = { optional = 1 },

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
On Thu, 18 Aug 2005, Yuval Kogman wrote: You sortof can: sub validate (+$credit_card_number, +$credit_card_expiration, +$credit_card_holder_name) where { defined $credit_card_number xor defined $credit_card_expiration

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
On Wed, 17 Aug 2005, Dave Rolsky wrote: Type Validation, isa, can Params::Validate allows for several ways to check the _value_ of a parameter. One way is to specify a primitive type like SCALAR or ARRAYREF. In P6 we have that with this: sub date (Scalar +$year is required, ...) I'm not

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:45:52PM -0500, Dave Rolsky wrote: And another question. How will I make Perl6 not do automatic coercion for me. If I have this sub: sub date (Int +$year is required, +$month, +$day) BTW, Pugs supports the ++ syntax, which iirc is said to be back in favour

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Larry Wall
On Thu, Aug 18, 2005 at 01:04:56PM +0800, Autrijus Tang wrote: : On Wed, Aug 17, 2005 at 11:45:52PM -0500, Dave Rolsky wrote: : And another question. How will I make Perl6 not do automatic coercion for : me. If I have this sub: : : sub date (Int +$year is required, +$month, +$day) : :