The (a=:0)](a) trick, while clever, does not work in the implementation
because (a =: 0) does not actually reduce the usecount of a until the
sentence completes.
Henry Rich
On 10/3/2016 7:21 PM, Raul Miller wrote:
This has been bothering me. After sleeping on it, I think I know how
to articulate my concerns:
It seems unnecessary.
First, the error handling in this case could restore the shape of a to
its original value and that seems like it should be simple.
However, also, in hypothetical analogous cases where error recovery
would be difficult, there's another approach that could be used:
replace the reference to a with (a=:0)](a)
This frees a's reference to the array, and makes it clear, also, that
it's good to destroy a when an error occurs.
a =: b ([ ,~ 3 ,~ ]) (a=:0)](a)
(Note also that the parenthesis around a are not optional here. There
are other expressions which achieve the same effect, but you can't use
just a bare a there and have it work right.)
Thanks,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm