When a name is deleted, the usecount for its value is decremented; so in

(+: [ 4!:55@((<'fred')"_)) fred =: 5

the usecount of (5) starts at 1, goes to 2 when assigned, then down to 1 when deleted, ending the sentence at 1. If the sentence came from the console, there will be a deletion waiting to be executed when the sentence completes, which will take the usecount to 0 and free the block.

(+: [ 4!:55@((<'fred')"_)) fred

is different. When a name is moved from the queue to the stack, the value is added to the NVR Queue (stands for Named Variable References). When a name on the NVR is deleted, the decrementing of the usecount is deferred until the sentence completes (and, if the value is the result of the sentence, further deferred until that value is no longer needed).

Henry Rich

On 10/6/2016 11:14 PM, Xiao-Yong Jin wrote:
On Oct 6, 2016, at 9:34 PM, Henry Rich <[email protected]> wrote:

that fact is settled by the observation that the name may be deleted while the 
value is in use, as in my example
And yet this works
   fred =: 5
   (+: [ 4!:55@((<'fred')"_)) fred
When the second sentence got executed, the data referred to by fred has 
usecount 1, doesn't it?  Does the usecount change inside that fork?  Can you 
please elaborate how the usecount is changed during execution of these two and 
how does it compare with putting these two in one sentence?

I'm only considering in these special cases where the interpreter could 
potentially interpreting
    name=:verb name=:X
as an inplace-able verb, and executing it in two stages
    name=:X
    name=:verb name
which could benefit from you inplace work.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to