[Jprogramming] Please remind me of the reason

Henry Rich henryhrich at gmail.com
Wed Aug 17 03:52:01 UTC 2022


Ah, now I remember.

First, a little detail: when you have the name 'func' in a sentence, and 
func is defined as a non-noun, what actually gets put onto the execution 
stack is

'func'~

This is what we mean by a 'reference' to the name func.  The reference 
is a non-noun, and when it gets executed, the name 'func' is looked up 
(again) and its value is executed.

[For those of us who worry about clock cycles (a set whose cardinality 
is perhaps one), the second lookup is wasted effort, and all the more 
vexing because of search paths and multiple threads; whence we have 
nameref caching and special treatment of nameless adverbs and one-word 
references.]

Using references, a tacit function can refer to an undefined name, and 
as long as the name is resolved before the function is /executed/, all 
will be well.

BUT.  Consider the sentence (in an explicit modifier):

    u otherverb y

What should be stacked for u?  'u'~ will not do, because that reference 
will be passed to otherverb, in whose space u will not have the right 
value when it is looked up.  No, u must be passed by /value/; and 
because there is no way to tell where a stacked value will go, /any/ 
reference to u or v must be stacked by value (that is, its value is 
stacked instead of 'u'~).

What I have shown here is that u and v must be stacked by value rather 
than by reference, always.

In earlier versions of J, x and y were sometimes verb arguments to 
modifiers (like modern u and v).  Thus they too were stacked by value 
always, as being easier than deciding when they needed to be values.

And then m and n were treated the same way, because since they have to 
be nouns anyway why not?

Then, when a name that must be stacked by value is undefined, what is 
there to do?  Nothing except value error.

Henry Rich



On 8/16/2022 2:40 PM, Henry Rich wrote:
> The names mnuvxy have always been special, giving value error if they 
> are not defined.  I'm not sure that's necessary now, but that's how it 
> is.
>
> The reason for having undefined names stack a reference is so that you 
> can have recursive definitions.  The need for that is less with mnuvxy.
>
> Henry Rich
>
> On 8/16/2022 2:30 PM, David Lambert wrote:
>> I think you've already explained this, but I don't recall why x and y 
>> should have special status in global namespace.  Perhaps I need to 
>> study the current documentation and release notes?
>>
>> $ j
>>    JVERSION
>> Engine: j904/j64avx2/linux
>> Beta-e: commercial/2022-07-16T19:24:59
>> Library: 9.04.01
>> Platform: Linux 64
>> Installer: J904 install
>> InstallPath: /home/lambertdw/downloads/installs/j904
>> Contact: www.jsoftware.com
>>
>>    x&y
>> |value error
>> |   x&    y
>>    X&Y
>> X&Y
>>
>>    i_used_to_be_a_verb
>> |value error: i_used_to_be_a_verb
>>
>> Thanks, Dave.
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>


-- 
This email has been checked for viruses by AVG antivirus software.
www.avg.com


More information about the Programming mailing list