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)
: 
: BTW, Pugs supports the ++ syntax, which iirc is said to be back in favour
: during the Oscon design meeting:
: 
:     sub date (Int ++$year, +$month, +$day)

Yes.

: > and someone does this:
: > 
: >  date('this year', 12, 1);
: > 
: > I'd prefer for this to fail, rather than giving me 0000-12-01!  I vaguely 
: > remember a mention of "use strict 'types'" either on this list or hanging 
: > out with some pugs folks at YAPC.
: 
: You will probably get:
: 
:     1. a compile time warning of unsafe coercion, possibly made fatal.
: and 
:     2. a NaN at runtime if you ignore the warning.

In this case it shouldn't get even that far since you'll get a fatal
error that says you tried to pass a positional list to a non-positional
parameter.  + isn't a synonym for ?.

Larry

Reply via email to