Simon Glover <[EMAIL PROTECTED]> wrote:
This code:
new P0, .Undef new P1, .Undef eq P0, P1, L1 print "not " L1: print "ok\n" end
prints "not ok". Should it?
That depends ;)
... If Parrot considers every Undef PMC to be distinct, it's going to make tasks like comparing arrays with large numbers of undefined elements much fiddlier than it should be.
Yep. Currently there is no chance to change that.
If the desire is that two new .Undef values are to be considered equal, then the attached patch achieves that.
- Sam Ruby
? undef.patch Index: undef.pmc =================================================================== RCS file: /cvs/public/parrot/classes/undef.pmc,v retrieving revision 1.10 diff -u -r1.10 undef.pmc --- undef.pmc 19 Oct 2004 01:25:35 -0000 1.10 +++ undef.pmc 31 Dec 2004 15:16:50 -0000 @@ -77,6 +77,15 @@ return 0; } + INTVAL is_equal (PMC* value) { +MMD_Undef: { + return 1; + } +MMD_DEFAULT: { + return 0; + } + } + } /*