I must have lost the test for 'explicit definition running' during one of the rewrites.

The original (6.02) seems to have it that xyuv are stacked by value when an explicit definition is running.  (Not mn).  uv must be stacked by value because they are passed as verb arguments into modifiers; xy needed that treatment in 6.02 because they might be verb arguments, but that usage has been eliminated.

I will change it so that only u v u. v. are stacked by value (and thus get value error if undefined), and only when used while an explicit definition is running.

x y m n will be like any other names.

Henry Rich

On 8/17/2022 2:41 PM, Jose Mario Quintana wrote:
Yet, as I recall, some change in behavior was introduced rather recently,

    NB. Fresh sessions...


    9!:14''
j902/j64/windows/beta-l/commercial/www.jsoftware.com/2020-11-05T15:47:37/clang-9-0-0/SLEEF=1

    x&y
x&y


    9!:14''
j903/j64/windows/release-a/commercial/www.jsoftware.com/2021-12-16T15:20:38/clang-13-0-0/SLEEF=1

    x&y
|value error
|   x&    y


See,

[Jprogramming] "accessor" concepts (jsoftware.com)
http://www.jsoftware.com/pipermail/programming/2021-September/058773.html
[Jprogramming] "accessor" concepts (jsoftware.com)
http://www.jsoftware.com/pipermail/programming/2021-September/058775.html

and

[Jprogramming] "accessor" concepts (jsoftware.com)
http://www.jsoftware.com/pipermail/programming/2021-September/058776.html




On Tue, Aug 16, 2022 at 11:52 PM Henry Rich <henryhr...@gmail.com> wrote:
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to