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
..............


⍝ 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
         ^   ^

Proposal:

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

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

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