On Tue, Aug 17, 2004 at 03:15:01AM -0600, Luke Palmer wrote: : Michel Pelletier writes: : > > We have to through an IndexError exception for Python. But that's not : > > done yet. : > : > Okay, I'll keep depth checking. I thought about attempting a patch, but : > Larry says return an undef containing an unthrown exception, Dan wonders : > if it should be an empty undef, and you say throw an exception, so I'm : > unsure what patch y'all want. ;) : : If it's a PerlArray, return an undef of some kind. It needn't contain : an unthrown exception yet (but if you can figure out how to do that, : great). A bare undef should be fine.
Bare undef is fine for now as long as it's not being tested directly against a particular address of undef (as happens in Perl 5). As long as definedness and truth are interrogated through a vtable somewhere, it should work out. What it'll probably eventually come down to in Perl 6 is that the typical undef is an exception object that happens to have the "undef" role mixed in, which causes the object to appear undefined and false, but otherwise behaves exactly like an exception object, and can easily be turned into a real thrown exception, or have its information incorporated into another exception. The point of unthrown exceptions is to let people program in an "undef" style without throwing away information about why the value is undefined. Larry