Aaron Sherman writes:
> On Fri, 2004-05-14 at 18:53, Luke Palmer wrote:
> > Aaron Sherman writes:
> 
> > > or did Larry mention a way to define a converter and I missed it?
> > 
> > Yep, that's what happened.  See Apocalypse 12 under "Overloading."
> 
> 
> Ok, so in the case of:
> 
>       my int $i = ...;
> 
> we should apply C<convert:as(..., ::int)>  and fail at run-time,
> correct? There's nothing wrong with TRYING to do the conversion, just as
> there should not be anything wrong with:
> 
>       my int $i = "4";
> 
> which has some pretty simple semantics in Perl.

Right. Though, constant folding at CHECK time might be able to tell when
you're *going* to do an invalid conversion and complain about it right
then.

In the case of ..., give it type error semantics.  That is, any
expression involving ... gets type "...".  Except instead of reporting
at the end of the statement, just suppress the errors and move on.

Luke

Reply via email to