Digest #234 2023-09-24

Contributions

[310] 2023-09-23 01:06:43 ruv wrote:

requestClarification - Why do we use +n and not u in the stack diagram for n>r and nr>

A citation from the Discussion section (in r1079):

On the data stack x_n ... x_1 +n because that is the way we usually specify a numbered number of cells (even for +n=0). See, e.g., get-order.

Well, in get-order n (the signed number data type) is probably incorrectly used after set-order, where n can be -1.

But in other words: pick, roll, cs-pick, cs-roll, — the unsigned number data type (identified by u) is used to indicate the number of items.

So the question is: why is +n used in the stack diagrams for n>r and nr> instead of u?

Replies

[r1108] 2023-09-23 08:25:11 Klaus_Schleisiek replies:

proposal - DEFER this not :-)

What's wrong with DEFER foo bla bla :noname <code for foo> ; IS foo No additional name needed.


[r1109] 2023-09-23 10:04:40 ruv replies:

proposal - DEFER this not :-)

@Klaus_Schleisiekavatar,

Form a readability point of view, "additional name" doesn't mean a dictionary entry, but additional mention of the name.

And, in the case of mutual recursion, this looks differ:

defer FOO

: BAR ( ... -- ... )
  bla bla
  FOO
  bla bla
;

:noname ( ... -- ... )
  bla bla
  BAR
  bla bla
; is FOO

What's wrong is poor readability. Since at the begin of the second definition it's unclear what is it for.

I can add a comment at the begin of this anonymous definition:

:noname ( ... -- ... ) \ the word "FOO"
  bla bla
  BAR
  bla bla
; is FOO

Such a comment is not elegant. And moreover, by that I introduce additional mention of the name FOO.