[Perldl] Indexing with bad values

Craig DeForest deforest at boulder.swri.edu
Thu Feb 23 08:52:34 HST 2012


I agree with Chris (sorry I couldn't answer this earlier): indexing by a bad value is, as they say, complicated.  I thought about implementing it in range, but it requires hacking on PP, something I have yet to get into.  

The Right thing to do would be to implement bad indexing in the Equivs code: if an index value is found to be BAD, copy the child's assigned BAD (instead of a target value) into the child PDL.  Going the other way (flowing child to parent), one would simply do nothing.  Something similar is done in range now for out-of-bounds values with "truncate" boundaries.



On Feb 23, 2012, at 11:38 AM, Chris Marshall wrote:

> Unfortunately, it might not be that simple.  There
> seems to be a number of possible ways to interpret
> index operations with a bad value: bad index value
> corresponds to a missing index, a bad index value
> corresponds to an invalid index, and the result
> would also be the same as a good index value
> selecting a source element with a bad value.
> 
> --Chris
> 
> On Thu, Feb 23, 2012 at 9:30 AM, Henning Glawe <eartoaster at gmx.net> wrote:
>> On Thu, Feb 23, 2012 at 07:35:48AM -0600, David Mertens wrote:
>>> This seems like a reasonable design to me. However, is the croaking behavior
>>> documented or tested?
>> 
>> It is documented as such in the POD of /usr/lib/perl5/PDL/Slices.pm:
>> 
>>    index barfs if any of the index values are bad.
>> 
>>> If so, this sort of change would introduce an
>>> incompatible change to a documented feature, which I would oppose. In that
>>> case, we could set a global or (for Perl 5.10 and up) a lexical flag to control
>>  this behavior.
>> 
>> This seems like a reasonable solution to me.
>> 
>> --
>> c u
>> henning
>> 
>> _______________________________________________
>> Perldl mailing list
>> Perldl at jach.hawaii.edu
>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> 
> _______________________________________________
> Perldl mailing list
> Perldl at jach.hawaii.edu
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> 





More information about the Perldl mailing list