On Wed, Dec 20, 2006 at 10:59:34PM +0000, Jonathan Worthington wrote: > Leopold Toetsch wrote: > >Am Mittwoch, 20. Dezember 2006 05:59 schrieb Will Coleda: > > > >>Are Hash and Array supposed to have different results on unset keys? > >> > > > >The .Undefs returned by Arrays are IMHO and unfortunate leftover of he > >early PerlArrays. We've managed to change the return result of hashes to > >.Null, so this should be possible with arrays too. > > > Changing the PMCs ain't hard. It's changing all the code that is getting > an undef back and testing for it that's the issue.
And once again, PGE, PAST-pm, perl6, and others may have a lot of places that expect to get Undef back instead of PMCNULL. We can certainly see about updating them to check for PMCNULL instead of undef, but they certainly exist. I asked about this particular discrepancy a couple of months ago (on IRC, I think), and IIRC the conclusion I was given then was something to the effect of "since ResizablePMCArray is auto-extendable it should return undefs for non-existent values." Leo is correct that this is probably coming from an original perl5-ish interpretation of how things work. I'm not strongly in favor or opposed to a particular design -- just pointing out that changing RPA to return NULL will probably impact a fair bit of PGE, PAST-pm, perl6, abc, etc. But if there's going to be a change, it'll be easier to fix it now rather than later. Pm