petdance/scratch — Issue #82: PMC 'Undef' does not support logical_not
Author: petdance
Created: 2011-11-01 05:26:56+00:00
State: open
Labels: bug, core, Pri-normal, Sev-medium

This code in Close:
{{{
ok(!(o.flat()), "flat: New object (undef flat) is false");
}}}
compiles to:
{{{
$P51 = o."flat"()
not $P52, $P51
"ok"($P52, "flat: New object (undef flat) is false")
}}}
And then fails, with:
{{{
logical_not() not implemented in class 'Undef'
}}}

Grepping for logical_not in *.pmc gives back only scalar.pmc.

* While I know that Perl's Undef has 0/nil/false/"" behavior, is that right for Parrot? (To what extent is Undef just a safe Null?)

* Should there even be a 'not' opcode? We've got isfalse.

* Should other pmc types be implementing logical_not?

* Should Undef be a subclass of scalar, and so inherit?