Simon Glover <[EMAIL PROTECTED]> wrote: > On Fri, 31 Dec 2004, Leopold Toetsch wrote:
>> This is a different issue. The ResizablePMCArray doesn't properly >> inherit the is_equal multi method from FixedPMCArray and as far as I can >> see, there is no Undef involved at all. Empty array slots are filled >> with PMCNULL, which is a singleton. The example works for FixedPMCArray. > and this code in get_pmc_keyed_int: > data = PMC_data(SELF); > if (data[key] == PMCNULL) > data[key] = pmc_new(INTERP, enum_class_Undef); > return data[key]; > When is_equal calls get_pmc_keyed_int to do the comparison, it creates > and returns an Undef PMC, rather than simply returing PMCNULL, and > since Undef != Undef, this ultimately causes the comparison to fail. Ouch. That looks very broken. It not only doesn't just compare the values (I see no reason, why the NULL PMC shouldn't have a is_equal and some other methods) - it also changes the array contents. > I guess the real question is should we be creating that Undef PMC; > i.e. should fetching an undefined element return a fully-fledged > Undef value, or simply a PMCNULL, which may later be promoted to a > real Undef? The semantics of core aggregates have to be defined with respect to such operations in a consistent way. We can do it either way ... > Simon leo