PDLPorters/pdl

$pdl->set( @pos, $value ) should croak if $value doesn't resolve to a scalar

djerius opened this issue · 2 comments

Attempting to set a value which isn't a scalar quietly does nothing:

Loaded PDL v2.085 (supports bad values)
pdl> $d = zeroes(10)

pdl> p $d->set( 0, sequence(3))
[0 0 0 0 0 0 0 0 0 0]

I would suggest that it blow up noisily.

[PS, while the docs for set imply it is obsolete, it has much lower overhead than using slice and .= ]

Clearly failing silently is bad, so that needs fixing.

Can you illustrate a case where it is quicker and better to use set rather than a bulk operation of assigning to a slice?

Evidently not. Anyway, it's fixed. Thanks for the report.