bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Incomplete value at Symbol.cc:130


From: Dr . Jürgen Sauermann
Subject: Re: Incomplete value at Symbol.cc:130
Date: Mon, 14 Dec 2020 17:54:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Hans-Peter,

thanks a lot for your feedback. See my comments below.

Best Regards,
Jürgen


On 12/14/20 4:39 PM, Hans-Peter Sorge wrote:
Hi,

I could not resist to experiment.....

      )clear
CLEAR WS     
        A←0
        A.A←1
DOMAIN ERROR+
        A.A←1
         ^ ^

      )clear
CLEAR WS
      A.A←1
      A←0      ⍝ Just replacing content of A.    
     
      B.B←2
      A←B.B    ⍝ Generates a trace. - probably should be A.B ←→ 2   

Incomplete value at Symbol.cc:130
Addr:    0x1ce1990
Rank:    0
..............


Fixed in SVN 1377.

⍝ A structured variable of any depth can be replaced by an assignment to the root variable.
      A.B.C.D←4
      A
.B:
.B.C:
.B.C.D: 4

      A←1   ⍝ Consistent with current assignment: replace variable content with RV. No DOMAIN ERROR.
      A
1


⍝ Assignment working one time only ..

      A.B.C ←1
      X.Y.Z ←2
      A.B.C←X.Y
      A
.B:
.B.C:
.B.C.Z: 2

⍝ should be repeatable:
      A.B.C←X.Y
DOMAIN ERROR+
      A.B.C←X.Y
         ^   ^

Actually no.

A.B.C←X.Y turns leaf A.B.C into a non-leaf, therefore an assignment to it it gives you DOMAIN ERROR.
Proposal:

Allow a non-leaf node to be replaced by a RV. it would then be consistent with how the current assignment works.    

I was thinking of this myself quite a bit. My current thoughts are that overriding a non-leaf can
destroy an arbitrary number of sub-variables, just like rm -R / and common *nix- wisdom has it that
this should be refused and that rm -Rf should be required instead. I actually spent a very long
night at the end of the 1970s after my boss did rm -R / by mistake. The counter-argument is that
you can erase arbitrary large non-structured values with an assignment in APL.

I also believe that assignment to a non-leaf is an implicit ⎕EX of the non-leaf which is not
consistent with plain variable assignment. In plain variable assignments, you can create a
variable and change a variable, but not erase a variable. That requires an explicit ⎕EX or )ERASE.

Above A.B.C is a (sub-) variable with value Z, so you can change it as long as it is a leaf (including
changing it to the value of another structured variable X.Y ←→ Z). But overriding it after it has
become a non-leaf is not allowed because that would implicitly ⎕EX it (which in the case of
plain variables is not possible resp. requires ⎕EX or )ERASE).

The model here is that ABC behaves like a variable but A.B does not (it is a collection of variables
and the questions is essentially whether it should be possible to override several (sub-) variables
by a single assignment).

I belive both alternatives have arguments speaking for them and I would like to hear more opinions
before allowing assignments to non-leaf sub-variables.
The assignment above "A.B.C ← X.Y" is actually an append -> A.B.C.Z rather than a replace,  what a "←" normally does.

I think the assignment should result in A.B.C ← X.Y.  ←→ A.B.Z

It probably would if the assignment were legal.
The append could be covered by the idiom  A.B.C. ← X.Y.  ←→ A.B.C.Z

.. just my thoughts.
 
      A.B.C ←1
      X.Y.Z ←2
      K.L.M ←3

      A.B.C ← X.Y K.L
DOMAIN ERROR+
      A.B.C←X.Y K.L
         ^   ^
'Idea:'
      A.B.C ← X.Y. K.L.   ←→ A.B.Z  A.B.M
and:     
      A.B.C. ← X.Y. K.L.   ←→ A.B.C.Z  A.B.C.M
     


Basically saying:
Using a trailing dots lets operators work with a structured name element.
A.B. ←→ C

given
A.B.a←1 ⋄ A.B.b←2 ⋄ A.B.c←3
X.Y.x←10 ⋄ X.Y.y←20 ⋄ X.Y.z←30

A.B. could result in structured name elements a b c. That is listing the leaf-node names. 
A.B. ← X.Y. 
could result in structured names A.B.x, A.B.y, A.B.z



Without trailing dots we get the content of a variable.
A.B.C  ←→ 1
 
      A.B.a←1
      A.B.b←2
      A.B.c←3
      A
      A.B
.a: 1

.b: 2

.c: 3

      A.B + 1
DOMAIN ERROR
      A.B+1
       ^ ^
⍝ could be
      A.B + 1
2 3 4


Sorry for the lengthy note.  

Best Regards
Hans-Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]