#43 adding bad value support for each pdl (not per type)

closed-accepted
nobody
5
2006-03-17
2005-01-10
Heiko
No

About half a year ago, I asked for the feature to have
a badvalue per pdl and not only per pdl-type. With good
intentions for this year, I tried to implement it by
myself, and I put the patch (against latest cvs) on
sourceforge.

It is switcheable on compile-time via perldl.conf and
even when switched on, it should be largely compatible
to the old behaviour.

$x = sequence(4)
$y = sequence(4)
$x->badflag(1)
$y->badflag(1)

$x->badvalue(3)
p $x
# this will result in [ 0 1 2 BAD ]
p $y
# this is now still [ 0 1 2 3 ]

double->badvalue(1)
p $x
# this will result in [ 0 1 2 BAD ]
p $y
# this is now still [ 0 BAD 2 3 ]

###########

$y will keep the type-badvalue as long as you don't
change $y->badvalue explicitly.

p $x->slice('2:3')
# is [ 2 BAD ] with badvalue 3
p $x + $y
# is [ 0 BAD 4 BAD ] with badvalue 1

#####

All tests run successfully. Hope the patch will be
useful for others, too. The patch will consume a double
+ a int more memory per pdl.

Discussion

  • Heiko
    Heiko
    2005-01-10

     
    Attachments
  • Craig DeForest
    Craig DeForest
    2006-03-17

    Logged In: YES
    user_id=20200

    The patch was accepted and applied to the CVS sources.
    Thanks for helping out!

     
  • Craig DeForest
    Craig DeForest
    2006-03-17

    • status: open --> closed
     
  • Craig DeForest
    Craig DeForest
    2006-03-17

    • status: closed --> closed-accepted
     
  • Craig DeForest
    Craig DeForest
    2006-03-17

    Logged In: YES
    user_id=20200

    Seems to break t/bad.t. I've incorporated the patch and
    marked it experimental. --zowie