Skip to content


Subversion checkout URL

You can clone with
Download ZIP


warn or fail on stringify/numify of a type object? #17

pmichaud opened this Issue · 3 comments

3 participants


Does numifying or stringifying a type object
produce an immediate 'warn' or a Failure? What's the
expected result from:

my $x;
my $y = +$x;
say 'alive';
say $y;

Is the warning generated at the point of assignment to $y
or at the point where $y is used?


s1n commented
@TimToady TimToady closed this in 5dfd996

These marginal conversions should fail() with a resumable warning for the exception, and the warning should support a .resume_value that can return the best guess at what was intended, 0 for +"foo", and 42 for +"42junk". (The default in the absence of a .resume_value is the null string.)

By using fail() we allow 'use fatal' to trap them immediately, and we allow parallel algorithms to check for definedness of individual results without having to install a special warning handler. The //die idiom will tend toward a fatal interpretation, while sinking such a half-defined value will warn but survive. The payload of the failure can be hand-checked for a .resume_value if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.