• Words should consume stack items - or not?

    From dxforth@21:1/5 to All on Mon Apr 24 15:26:40 2023
    Which is preferred and why?

    \ Bump blank lines
    : ?BUMP ( u -- )
    if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    dup ?bump ...

    or

    \ Bump blank lines
    : ?BUMP ( u -- u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Mon Apr 24 00:09:32 2023
    On Monday, April 24, 2023 at 1:26:43 AM UTC-4, dxforth wrote:
    Which is preferred and why?

    \ Bump blank lines
    : ?BUMP ( u -- )
    if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    dup ?bump ...

    or

    \ Bump blank lines
    : ?BUMP ( u -- u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...

    It all just seems simpler to let the words consume the arguments, unless there is a specific reason to do otherwise. One would be because the use always requires the same parameters after the word. I do this sometimes. It just seems simpler to put the
    code to manage this inside the word, rather than duplicate it each time the word is used.

    I suppose some would say I'm not doing a good job of factoring.

    --

    Rick C.

    - Get 1,000 miles of free Supercharging
    - Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Mon Apr 24 13:02:16 2023
    In article <u253ug$75jn$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote: >Which is preferred and why?

    \ Bump blank lines
    : ?BUMP ( u -- )
    if blanks off end 1 blanks +! ;

    Bad style alert. Routines are documented, data is not.
    You could maybe dispense with documenting the routines,
    if `` blanks '' were documented.


    \ Write a line
    : PUT ( a u -- )
    dup ?bump ...

    or

    \ Bump blank lines
    : ?BUMP ( u -- u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Mon Apr 24 20:31:05 2023
    On 24/04/2023 5:09 pm, Lorem Ipsum wrote:
    On Monday, April 24, 2023 at 1:26:43 AM UTC-4, dxforth wrote:
    Which is preferred and why?

    \ Bump blank lines
    : ?BUMP ( u -- )
    if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    dup ?bump ...

    or

    \ Bump blank lines
    : ?BUMP ( u -- u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...

    It all just seems simpler to let the words consume the arguments, unless there is a specific reason to do otherwise. One would be because the use always requires the same parameters after the word. I do this sometimes. It just seems simpler to put
    the code to manage this inside the word, rather than duplicate it each time the word is used.

    I suppose some would say I'm not doing a good job of factoring.

    You don't wish to factor because there's not enough context?
    Would this be clearer?

    \ Bump blank lines
    : ?BUMP ( a u -- a u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Mon Apr 24 11:23:05 2023
    Which is preferred and why?

    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Zbig on Mon Apr 24 12:53:01 2023
    On Monday, April 24, 2023 at 2:23:06 PM UTC-4, Zbig wrote:
    Which is preferred and why?
    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.

    If a rule doesn't provide some advantage, then why have it? I suppose there is a small advantage simply from being consistent. But, if you break the rule for cases where there's an advantage, how is that different from having no rule and doing each
    case on its own merits?

    So a rule or guild line should have a justification. Then you can make intelligent decisions about when to ignore the rule.

    In this case, I think the justification is the clutter from needing to drop the value that was duplicated, as well as the wasted CPU cycles in duplicating, then dropping for no utility. I tend to follow the rule, but there are times when the duplication
    is always needed, and I get tired of the clutter, especially when it is in consecutive lines of code in the same word.

    I do find it difficult to make my Forth code understandable. I'm not hugely experienced, so I expect there are a number of issues with my coding that contributes to this. I will be getting a test of my coding skills here shortly, when I redesign the
    test fixture for my new board.

    --

    Rick C.

    + Get 1,000 miles of free Supercharging
    + Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Mon Apr 24 13:37:10 2023
    Which is preferred and why?
    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.
    If a rule doesn't provide some advantage, then why have it? I suppose there is a small advantage simply from being consistent. But, if you break the rule for cases where there's an advantage, how is that different from having no rule and doing each
    case on its own merits?

    I will answer using an analogy: in the photography, to create a nice (or even beautiful) picture, you need to know (and to apply) a few rules of composition. Of course there are situations when you decide, that you'll get better picture when you break
    particular rule of composition!
    …but it should be your *sane* decision — not the lack of knowledge. You won't get nice picture by not learning anything at all.

    Why sticking to the rule pays off? By being consistent you keep your program comprehensible at least for you (if you are willing to expand its functionality a year later, or simply to fix it).
    But yes, you may decide you don't like the rule, if it doesn't suit you that well; for example: there's a good Forth83 compiler for C-64 called VolksForth, which DOESN'T clear the stack after you mistype something in the command line. Why they preferred
    such behavior — I'm not sure, but surely it's an example of freedom Forth programmer has at his disposal; like creating the compiler that acts differently, „just like that”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Tue Apr 25 11:49:46 2023
    On 25/04/2023 4:23 am, Zbig wrote:
    Which is preferred and why?

    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.

    In my case following the rule left me uncomfortable and at first
    I couldn't pinpoint why. I finally came to the conclusion I was
    breaking other rules...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Zbig on Mon Apr 24 19:23:29 2023
    On Monday, April 24, 2023 at 4:37:11 PM UTC-4, Zbig wrote:
    Which is preferred and why?
    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.
    If a rule doesn't provide some advantage, then why have it? I suppose there is a small advantage simply from being consistent. But, if you break the rule for cases where there's an advantage, how is that different from having no rule and doing each
    case on its own merits?
    I will answer using an analogy: in the photography, to create a nice (or even beautiful) picture, you need to know (and to apply) a few rules of composition. Of course there are situations when you decide, that you'll get better picture when you break
    particular rule of composition!
    …but it should be your *sane* decision — not the lack of knowledge. You won't get nice picture by not learning anything at all.

    Why sticking to the rule pays off? By being consistent you keep your program comprehensible at least for you (if you are willing to expand its functionality a year later, or simply to fix it).
    But yes, you may decide you don't like the rule, if it doesn't suit you that well; for example: there's a good Forth83 compiler for C-64 called VolksForth, which DOESN'T clear the stack after you mistype something in the command line. Why they
    preferred such behavior — I'm not sure, but surely it's an example of freedom Forth programmer has at his disposal; like creating the compiler that acts differently, „just like that”.

    There are many, many things in programming where there is no rule. We tolerate inconsistency in those things. The question is, why does consistency matter more with duplicating arguments, than with other things?

    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?

    --

    Rick C.

    -- Get 1,000 miles of free Supercharging
    -- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ron AARON@21:1/5 to Lorem Ipsum on Tue Apr 25 07:31:03 2023
    On 25/04/2023 5:23, Lorem Ipsum wrote:
    On Monday, April 24, 2023 at 4:37:11 PM UTC-4, Zbig wrote:
    Which is preferred and why?
    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.
    If a rule doesn't provide some advantage, then why have it? I suppose there is a small advantage simply from being consistent. But, if you break the rule for cases where there's an advantage, how is that different from having no rule and doing each
    case on its own merits?
    I will answer using an analogy: in the photography, to create a nice (or even beautiful) picture, you need to know (and to apply) a few rules of composition. Of course there are situations when you decide, that you'll get better picture when you break
    particular rule of composition!
    …but it should be your *sane* decision — not the lack of knowledge. You won't get nice picture by not learning anything at all.

    Why sticking to the rule pays off? By being consistent you keep your program comprehensible at least for you (if you are willing to expand its functionality a year later, or simply to fix it).
    But yes, you may decide you don't like the rule, if it doesn't suit you that well; for example: there's a good Forth83 compiler for C-64 called VolksForth, which DOESN'T clear the stack after you mistype something in the command line. Why they
    preferred such behavior — I'm not sure, but surely it's an example of freedom Forth programmer has at his disposal; like creating the compiler that acts differently, „just like that”.

    There are many, many things in programming where there is no rule. We tolerate inconsistency in those things. The question is, why does consistency matter more with duplicating arguments, than with other things?

    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?

    Some reasons to enforce consistency include, but are not limited to:

    - naming conventions can help you understand the purpose of a word or
    variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes
    the purpose of the code more clear

    - you work with others on the same code-base; consistency means less
    time trying to unravel others' code

    - working with a set of rules means you spend less time working out
    naming / spacing / commenting conventions, and just follow the script in
    your head

    - consistent spacing rules make the layout of the code easier to follow.

    etc...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Ron AARON on Mon Apr 24 23:10:27 2023
    On Tuesday, April 25, 2023 at 12:31:06 AM UTC-4, Ron AARON wrote:
    On 25/04/2023 5:23, Lorem Ipsum wrote:
    On Monday, April 24, 2023 at 4:37:11 PM UTC-4, Zbig wrote:
    Which is preferred and why?
    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.
    If a rule doesn't provide some advantage, then why have it? I suppose there is a small advantage simply from being consistent. But, if you break the rule for cases where there's an advantage, how is that different from having no rule and doing each
    case on its own merits?
    I will answer using an analogy: in the photography, to create a nice (or even beautiful) picture, you need to know (and to apply) a few rules of composition. Of course there are situations when you decide, that you'll get better picture when you
    break particular rule of composition!
    …but it should be your *sane* decision — not the lack of knowledge. You won't get nice picture by not learning anything at all.

    Why sticking to the rule pays off? By being consistent you keep your program comprehensible at least for you (if you are willing to expand its functionality a year later, or simply to fix it).
    But yes, you may decide you don't like the rule, if it doesn't suit you that well; for example: there's a good Forth83 compiler for C-64 called VolksForth, which DOESN'T clear the stack after you mistype something in the command line. Why they
    preferred such behavior — I'm not sure, but surely it's an example of freedom Forth programmer has at his disposal; like creating the compiler that acts differently, „just like that”.

    There are many, many things in programming where there is no rule. We tolerate inconsistency in those things. The question is, why does consistency matter more with duplicating arguments, than with other things?

    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?
    Some reasons to enforce consistency include, but are not limited to:

    - naming conventions can help you understand the purpose of a word or variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes
    the purpose of the code more clear

    - you work with others on the same code-base; consistency means less
    time trying to unravel others' code

    - working with a set of rules means you spend less time working out
    naming / spacing / commenting conventions, and just follow the script in your head

    - consistent spacing rules make the layout of the code easier to follow.

    etc...

    You are talking about being consistent in specific purposes. Naming conventions have some rationale.

    My point is that I haven't heard anyone make a rationale regarding the issue of when to let data remain on the stack.

    --

    Rick C.

    -+ Get 1,000 miles of free Supercharging
    -+ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Ron AARON on Mon Apr 24 23:07:00 2023
    On Tuesday, April 25, 2023 at 12:31:06 AM UTC-4, Ron AARON wrote:
    On 25/04/2023 5:23, Lorem Ipsum wrote:
    On Monday, April 24, 2023 at 4:37:11 PM UTC-4, Zbig wrote:
    Which is preferred and why?
    I think if there's no real gain to do otherwise, then
    it is better to stick to the rule.
    Of course the rule may be broken if the result is shorter,
    more comprehensible, or just faster executing program.
    If a rule doesn't provide some advantage, then why have it? I suppose there is a small advantage simply from being consistent. But, if you break the rule for cases where there's an advantage, how is that different from having no rule and doing each
    case on its own merits?
    I will answer using an analogy: in the photography, to create a nice (or even beautiful) picture, you need to know (and to apply) a few rules of composition. Of course there are situations when you decide, that you'll get better picture when you
    break particular rule of composition!
    …but it should be your *sane* decision — not the lack of knowledge. You won't get nice picture by not learning anything at all.

    Why sticking to the rule pays off? By being consistent you keep your program comprehensible at least for you (if you are willing to expand its functionality a year later, or simply to fix it).
    But yes, you may decide you don't like the rule, if it doesn't suit you that well; for example: there's a good Forth83 compiler for C-64 called VolksForth, which DOESN'T clear the stack after you mistype something in the command line. Why they
    preferred such behavior — I'm not sure, but surely it's an example of freedom Forth programmer has at his disposal; like creating the compiler that acts differently, „just like that”.

    There are many, many things in programming where there is no rule. We tolerate inconsistency in those things. The question is, why does consistency matter more with duplicating arguments, than with other things?

    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?
    Some reasons to enforce consistency include, but are not limited to:

    - naming conventions can help you understand the purpose of a word or variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes
    the purpose of the code more clear

    - you work with others on the same code-base; consistency means less
    time trying to unravel others' code

    - working with a set of rules means you spend less time working out
    naming / spacing / commenting conventions, and just follow the script in your head

    - consistent spacing rules make the layout of the code easier to follow.

    etc...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Mon Apr 24 23:34:35 2023
    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?

    Consistency adds more order — and order removes (at least part of) the chore, when you know „what to expect”. You expect the word to consume its argument(s).

    And why the rule of „consuming arguments”? I believe this comes from
    the fact, that the primitives consume them. So — exactly to keep it consistent
    way — came the rule, also for „higher level” words.
    And actually by making the words consuming their arguments we get better,
    more natural-looking code; which is better IYO: „4 STARS” or „4 STARS DROP”?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Zbig on Tue Apr 25 06:24:39 2023
    Zbig <zbigniew2011@gmail.com> writes:
    there's a good Forth83 compiler for C-64 called VolksF=
    orth, which DOESN'T clear the stack after you mistype something in the comm= >and line. Why they preferred such behavior =E2=80=94 I'm not sure

    I think the idea is that you want to continue the computation, and
    therefore want to preserve the stack contents. E.g.:

    foo bar ( n )
    3 + duo . a !
    ^^^
    Error: Undefined word

    If the stack contents are preserved, the user can just type

    dup . a !

    and finish the work.

    Gforth originally inherited this behaviour from its grandparent
    VolksForth (e.g., you can see it in gforth-0.3.0). However, it does
    not fit Gforth, because Gforth has command-line history. What a user
    usually does after an error is to type Cursor-up, change the line to
    fix the mistake, then type "Enter" to interpret the line again. In
    the example above, one would type "Cursor-up Cursor-up Enter
    Cursor-Down <fix mistake> Enter" to interpret both lines. In that
    setting, the stack contents are usually an annoyance that you don't
    want. So we changed the behaviour to the conventional one of clearing
    the stack.

    One thing that one could do on an undefined-word error is to save the
    stack contents and the line starting at the undefined word, and have a
    key that restores the stack contents and puts the line starting at the undefined word up for editing, and places the cursor at the undefined
    word.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Tue Apr 25 06:44:41 2023
    dxforth <dxforth@gmail.com> writes:
    Which is preferred and why?

    \ Bump blank lines
    : ?BUMP ( u -- )
    if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    dup ?bump ...

    or

    \ Bump blank lines
    : ?BUMP ( u -- u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...

    If you don't know a good reason for the second variant, the first is
    preferred, as you are aware of. That's even true when the code for
    such an example would become shorter when you break the convention
    (which is not the case in this example; it just moves the DUP between
    the words).

    That being said, there have been rare cases where I have not followed
    this convention, and have instead left the stack alone, mainly for
    words that one may want to insert or delete without worrying about the
    stack contents. Even the standard has such a word: .S. Maybe ?BUMP
    is one of these words, too?

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ron AARON@21:1/5 to Lorem Ipsum on Tue Apr 25 10:42:37 2023
    On 25/04/2023 9:10, Lorem Ipsum wrote:
    On Tuesday, April 25, 2023 at 12:31:06 AM UTC-4, Ron AARON wrote:
    On 25/04/2023 5:23, Lorem Ipsum wrote:

    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?
    Some reasons to enforce consistency include, but are not limited to:

    - naming conventions can help you understand the purpose of a word or
    variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes
    the purpose of the code more clear

    - you work with others on the same code-base; consistency means less
    time trying to unravel others' code

    - working with a set of rules means you spend less time working out
    naming / spacing / commenting conventions, and just follow the script in
    your head

    - consistent spacing rules make the layout of the code easier to follow.

    etc...

    You are talking about being consistent in specific purposes. Naming conventions have some rationale.

    My point is that I haven't heard anyone make a rationale regarding the issue of when to let data remain on the stack.

    OK, so in 8th there are lots of words which leave data on the stack. For example, file I/O words.

    The rationale is that if you e.g. read from a file, you will probably
    want to read from it again soon. Removing it from the stack and the
    putting it back on the stack later is more expensive than just leaving
    it be.

    Of course it really depends on your use-case, and I don't think you'll
    find a justification for one way or the other which applies generally.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Tue Apr 25 20:53:59 2023
    On 25/04/2023 4:44 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    Which is preferred and why?

    \ Bump blank lines
    : ?BUMP ( u -- )
    if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    dup ?bump ...

    or

    \ Bump blank lines
    : ?BUMP ( u -- u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...

    If you don't know a good reason for the second variant, the first is preferred, as you are aware of. That's even true when the code for
    such an example would become shorter when you break the convention
    (which is not the case in this example; it just moves the DUP between
    the words).

    I came to see both as wrong. ?BUMP wasn't working on 'u' - it was working
    on a string, namely 'a u'. That left two options:

    ?BUMP ( a u -- )

    or

    ?BUMP ( a u -- a u )

    The first would require me to write 2DUP ?BUMP. Since the passed 'a' is
    never used I'd also need a DROP. The second version is cheaper as it only requires a DUP.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to Anton Ertl on Tue Apr 25 15:02:49 2023
    In article <2023Apr25.084441@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    dxforth <dxforth@gmail.com> writes:
    Which is preferred and why?

    \ Bump blank lines
    : ?BUMP ( u -- )
    if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    dup ?bump ...

    or

    \ Bump blank lines
    : ?BUMP ( u -- u )
    dup if blanks off end 1 blanks +! ;

    \ Write a line
    : PUT ( a u -- )
    ?bump ...

    If you don't know a good reason for the second variant, the first is >preferred, as you are aware of. That's even true when the code for
    such an example would become shorter when you break the convention
    (which is not the case in this example; it just moves the DUP between
    the words).

    That being said, there have been rare cases where I have not followed
    this convention, and have instead left the stack alone, mainly for
    words that one may want to insert or delete without worrying about the
    stack contents. Even the standard has such a word: .S. Maybe ?BUMP
    is one of these words, too?

    An example of these words are checking for error conditions.
    I have the convention for those optional words enclosed in ? ?.
    For example ?ERROR16? detects an error condition and the
    ?'s indicate that the word is optional, can left out, leaving
    the functionality alone. Mostly you don't want error detection
    (and e.g. logging) to interfere with functionality.
    Checking the code you don't want to be bothered with these
    words.


    - anton

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to Anton Ertl on Tue Apr 25 14:55:17 2023
    In article <2023Apr25.082439@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    <SNIP>

    One thing that one could do on an undefined-word error is to save the
    stack contents and the line starting at the undefined word, and have a
    key that restores the stack contents and puts the line starting at the >undefined word up for editing, and places the cursor at the undefined
    word.

    While debugging it is convenient to continuously see the stack.
    That is what my word DO-DEBUG does.
    Combining this is with a terminal that allows to copy text from
    screen is sufficient, to recover from a typo.
    Saying that I don't like the advice of "starting forth" to type lksfdjlfdskjdsfl to clear the stack by forcing an error.
    I have introduced CLS that clears the stack.
    (In 70's Forth that saved one word.)
    I think that QUIT would be much cleaner if it was called
    REPL and leave the stack clearing for the user to decide.

    Repeating the code that lead to the content, even if a command
    repeater is present, is relatively cumbersome.
    I'm tempted to define a repl called BREAK and then define
    : QUIT CLS BREAK ;
    BREAK is a factor that you can insert in a word that
    you really don't know to debug.
    (Nested break's can end by a ^D).


    - anton
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Zbig on Tue Apr 25 08:02:31 2023
    On Tuesday, April 25, 2023 at 2:34:36 AM UTC-4, Zbig wrote:
    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?
    Consistency adds more order — and order removes (at least part of) the chore,
    when you know „what to expect”. You expect the word to consume its argument(s).

    And why the rule of „consuming arguments”? I believe this comes from
    the fact, that the primitives consume them. So — exactly to keep it consistent
    way — came the rule, also for „higher level” words.
    And actually by making the words consuming their arguments we get better, more natural-looking code; which is better IYO: „4 STARS” or „4 STARS DROP”?

    Or...

    2dup foobar vs. foobar

    ???

    See, the knife cuts both ways.

    “A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines."

    So, have a reason for the rule, or don't have the rule.

    --

    Rick C.

    +- Get 1,000 miles of free Supercharging
    +- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Tue Apr 25 08:46:49 2023
    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?
    Consistency adds more order — and order removes (at least part of) the chore,
    when you know „what to expect”. You expect the word to consume its argument(s).

    And why the rule of „consuming arguments”? I believe this comes from the fact, that the primitives consume them. So — exactly to keep it consistent
    way — came the rule, also for „higher level” words.
    And actually by making the words consuming their arguments we get better, more natural-looking code; which is better IYO: „4 STARS” or „4 STARS DROP”?
    Or...

    2dup foobar vs. foobar

    It's not „or” — try this still using STARS.

    : STARS ( n -- ) 0 DO 42 EMIT LOOP ;

    ???

    See, the knife cuts both ways.

    But I don't need any 2dup using STARS. Do you?

    “A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines."

    So, have a reason for the rule, or don't have the rule.

    An average „cliche” isn't any rule.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Zbig on Tue Apr 25 09:00:49 2023
    On Tuesday, April 25, 2023 at 11:46:51 AM UTC-4, Zbig wrote:
    Sorry, but I don't put much stock in consistency for the sake of consistency. If there is literally no identifiable reason to enforce consistency, then it's just extra work. Am I not making myself clear?
    Consistency adds more order — and order removes (at least part of) the chore,
    when you know „what to expect”. You expect the word to consume its argument(s).

    And why the rule of „consuming arguments”? I believe this comes from the fact, that the primitives consume them. So — exactly to keep it consistent
    way — came the rule, also for „higher level” words.
    And actually by making the words consuming their arguments we get better,
    more natural-looking code; which is better IYO: „4 STARS” or „4 STARS DROP”?
    Or...

    2dup foobar vs. foobar
    It's not „or” — try this still using STARS.

    : STARS ( n -- ) 0 DO 42 EMIT LOOP ;
    ???

    See, the knife cuts both ways.
    But I don't need any 2dup using STARS. Do you?

    Sorry, but if you want to make a point, you need to actually explain the point you are trying to make.


    “A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines."

    So, have a reason for the rule, or don't have the rule.
    An average „cliche” isn't any rule.

    Hmmm... it's as good as any of the logic you have applied, and comes from an authority.

    --

    Rick C.

    ++ Get 1,000 miles of free Supercharging
    ++ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Tue Apr 25 09:07:14 2023
    Sorry, but if you want to make a point, you need to actually explain the point you are trying to make.

    It's YOU who are trying to „make a point” by senselessly inserting DUPs „here and there”.

    So I gave you an example, and try to make your point by using DUP / 2DUP sensibly
    and by proving it would be better to have non-consuming STARS.

    “A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines."

    So, have a reason for the rule, or don't have the rule.
    An average „cliche” isn't any rule.
    Hmmm... it's as good as any of the logic you have applied, and comes from an authority.

    OK, let's see: „Ralph Waldo Emerson once wrote: “A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines." His point was that only small-minded men refused to rethink their prior beliefs. Or,
    put another way, he thought that today's intuition could trump yesterday's conclusions.”

    So I've rethought my prior beliefs and I've found that there's still nothing wrong with them.
    You mileage, of course, may vary.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Hendrix@21:1/5 to none albert on Tue Apr 25 10:15:14 2023
    On Tuesday, April 25, 2023 at 2:55:21 PM UTC+2, none albert wrote:
    [..]
    I'm tempted to define a repl called BREAK and then define
    : QUIT CLS BREAK ;
    BREAK is a factor that you can insert in a word that
    you really don't know to debug.
    (Nested break's can end by a ^D).

    iForth has a word called ^^ . It remembers the sourcefile
    line number. When that line is reached, it pauses, calls my
    editor to show the file and highlighted line, shows all
    stacks, and waits for ^Q to hard break, anything else to
    continue. For difficult cases I compile all kinds of
    throw-away diagnostics code before "^^". I wouldn't survive
    without this facility.

    gForth has something similar.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Wed Apr 26 12:22:09 2023
    On 26/04/2023 1:46 am, Zbig wrote:

    “A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines."

    So, have a reason for the rule, or don't have the rule.

    An average „cliche” isn't any rule.

    'Rule' may be overstating it. Tried to track down the source. Best I could find was:

    "Tip: Let definitions consume their arguments." - Thinking FORTH.

    The example Brodie gives is DUP positioned in the wrong place resulting in extraneous
    execution and need for DROP. If there's a rule in here it would be avoid writing
    unnecessary code...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Wed Apr 26 01:24:54 2023
    "Tip: Let definitions consume their arguments." - Thinking FORTH.

    The example Brodie gives is DUP positioned in the wrong place resulting in extraneous
    execution and need for DROP. If there's a rule in here it would be avoid writing
    unnecessary code...

    Regardless of Brodie example's value the rule was rather obvious to me.
    In Forth the stack is used for passing the arguments, correct? Then if in case of „infix” programming languages the arguments are just transferred from one
    command to another — not remaining „somewhere in the air” after the job is
    done — why the Forth words should act differently?
    As I already wrote: IMHO only when there's a good reason for this. But long ago I've experienced that leaving too many values on the stack „for future use” in most
    cases means later troublesome access to them (causing „stack noise”) and that
    better is to use a few variables (or memory array) as a storage.
    Of course your initial example is so simplistic, that it can be written one way, or
    another; it doesn't make that much of difference in this particular case.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Wed Apr 26 19:04:38 2023
    On 26/04/2023 6:24 pm, Zbig wrote:
    "Tip: Let definitions consume their arguments." - Thinking FORTH.

    The example Brodie gives is DUP positioned in the wrong place resulting in extraneous
    execution and need for DROP. If there's a rule in here it would be avoid writing
    unnecessary code...

    Regardless of Brodie example's value the rule was rather obvious to me.
    In Forth the stack is used for passing the arguments, correct? Then if in case
    of „infix” programming languages the arguments are just transferred from one
    command to another — not remaining „somewhere in the air” after the job is
    done — why the Forth words should act differently?

    In those infix languages (presumably you mean C) are not those input parameters which end up in locals but copies?

    As I already wrote: IMHO only when there's a good reason for this. But long ago
    I've experienced that leaving too many values on the stack „for future use” in most
    cases means later troublesome access to them (causing „stack noise”) and that
    better is to use a few variables (or memory array) as a storage.
    Of course your initial example is so simplistic, that it can be written one way, or
    another; it doesn't make that much of difference in this particular case.

    I don't believe I had a choice doing it the way I finally did. Readability and least
    code largely forced my hand - which is the way I like it. Having a choice one may
    just as well flip a coin.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Wed Apr 26 19:59:13 2023
    On 26/04/2023 7:21 pm, Zbig wrote:
    In those infix languages (presumably you mean C) are not those input parameters
    which end up in locals but copies?

    But it's not we're talking about — not about how that data is then used, but about
    leaving (or not leaving) the copies of input parameters for ev. „future use”.
    These locals are inside of the „acceptor”.

    Should the next function needs the same parameters it gets them from the source.
    In forth it can get them from the stack.


    I don't believe I had a choice doing it the way I finally did. Readability and least
    code largely forced my hand - which is the way I like it. Having a choice one may
    just as well flip a coin.

    It is up to the programmer to select the appropriate criterion.

    The application has criteria. I'm not sure the programmer does.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Wed Apr 26 02:21:22 2023
    In those infix languages (presumably you mean C) are not those input parameters
    which end up in locals but copies?

    But it's not we're talking about — not about how that data is then used, but about
    leaving (or not leaving) the copies of input parameters for ev. „future use”.
    These locals are inside of the „acceptor”.

    I don't believe I had a choice doing it the way I finally did. Readability and least
    code largely forced my hand - which is the way I like it. Having a choice one may
    just as well flip a coin.

    It is up to the programmer to select the appropriate criterion.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Wed Apr 26 20:47:06 2023
    On 26/04/2023 8:17 pm, Zbig wrote:
    Should the next function needs the same parameters it gets them from the source.
    In forth it can get them from the stack.

    Yep — „should the next function”.

    I don't believe I had a choice doing it the way I finally did. Readability and least
    code largely forced my hand - which is the way I like it. Having a choice one may
    just as well flip a coin.

    It is up to the programmer to select the appropriate criterion.
    The application has criteria. I'm not sure the programmer does.

    I believe no serious application relies on result of coin flipping to select where should it take its input from.

    "Of course your initial example is so simplistic, that it can be written one way, or
    another; it doesn't make that much of difference in this particular case."

    That's coin-flipping. I was coin-flipping and it bugged me. There had to be a better answer and I wasn't prepared to rest until I found it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Wed Apr 26 03:17:54 2023
    Should the next function needs the same parameters it gets them from the source.
    In forth it can get them from the stack.

    Yep — „should the next function”.

    I don't believe I had a choice doing it the way I finally did. Readability and least
    code largely forced my hand - which is the way I like it. Having a choice one may
    just as well flip a coin.

    It is up to the programmer to select the appropriate criterion.
    The application has criteria. I'm not sure the programmer does.

    I believe no serious application relies on result of coin flipping to select where should it take its input from.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Thu Apr 27 10:55:58 2023
    On 25/04/2023 4:10 pm, Lorem Ipsum wrote:
    On Tuesday, April 25, 2023 at 12:31:06 AM UTC-4, Ron AARON wrote:
    ...
    Some reasons to enforce consistency include, but are not limited to:

    - naming conventions can help you understand the purpose of a word or
    variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes
    the purpose of the code more clear

    - you work with others on the same code-base; consistency means less
    time trying to unravel others' code

    - working with a set of rules means you spend less time working out
    naming / spacing / commenting conventions, and just follow the script in
    your head

    - consistent spacing rules make the layout of the code easier to follow.

    etc...

    You are talking about being consistent in specific purposes. Naming conventions have some rationale.

    My point is that I haven't heard anyone make a rationale regarding the issue of when to let data remain on the stack.

    One 'rule' I frequently seem to run into trouble with is ordering of addresses and counts - specifically CMOVE et al. Gut feeling is it should have been
    ( src len dest ) but I've never been motivated enough to do the work to prove/ disprove it. I figure that's a job for academics.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Wed Apr 26 18:41:32 2023
    On Wednesday, April 26, 2023 at 8:56:00 PM UTC-4, dxforth wrote:
    On 25/04/2023 4:10 pm, Lorem Ipsum wrote:
    On Tuesday, April 25, 2023 at 12:31:06 AM UTC-4, Ron AARON wrote:
    ...
    Some reasons to enforce consistency include, but are not limited to:

    - naming conventions can help you understand the purpose of a word or
    variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes >> the purpose of the code more clear

    - you work with others on the same code-base; consistency means less
    time trying to unravel others' code

    - working with a set of rules means you spend less time working out
    naming / spacing / commenting conventions, and just follow the script in >> your head

    - consistent spacing rules make the layout of the code easier to follow. >>
    etc...

    You are talking about being consistent in specific purposes. Naming conventions have some rationale.

    My point is that I haven't heard anyone make a rationale regarding the issue of when to let data remain on the stack.
    One 'rule' I frequently seem to run into trouble with is ordering of addresses
    and counts - specifically CMOVE et al. Gut feeling is it should have been
    ( src len dest ) but I've never been motivated enough to do the work to prove/
    disprove it. I figure that's a job for academics.

    I have nearly zero knowledge of optimizations, but it would seem to me this is the sort of thing that can be optimized by the tools. Write the code how you want, and let the tools arrange the assembly code to minimize stack juggling. In the end, most
    Forth code runs on a register CPU, no?

    I did some work on an indexed stack machine instruction set. It could dig some small number of locations down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack instructions. The test case was an
    interrupt routine to manage a DDS NCO. I think there were three parameters on the stack and of course, the current phase value. I believe the cycle count dropped from 80 to 50 or something equivalent. I have no idea how to write an optimizing Forth
    compiler. But I think it could have been very fast, for the number of gates used. But then, some of the processors on Jim Brakefield's list are very impressive and likely hard to beat. However, there is no actual benchmark numbers. He counts
    instructions per second and per LUT, without comparing how effective the instructions are, if I'm not mistaken.

    --

    Rick C.

    --- Get 1,000 miles of free Supercharging
    --- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@21:1/5 to Lorem Ipsum on Thu Apr 27 02:12:08 2023
    Lorem Ipsum schrieb am Donnerstag, 27. April 2023 um 03:41:33 UTC+2:
    I did some work on an indexed stack machine instruction set. It could dig some small number of locations down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack instructions.

    It's an old questionable thing. Simple demo case subtraction:
    : Mb ( a b -- diff b ) tuck - swap ;
    With a word called UP (to step up the stack pointer):
    : Mb ( a b -- diff b ) - up ;
    Microscopic improvement and unportable.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Thu Apr 27 20:57:12 2023
    On 27/04/2023 11:41 am, Lorem Ipsum wrote:
    On Wednesday, April 26, 2023 at 8:56:00 PM UTC-4, dxforth wrote:
    On 25/04/2023 4:10 pm, Lorem Ipsum wrote:
    On Tuesday, April 25, 2023 at 12:31:06 AM UTC-4, Ron AARON wrote:
    ...
    Some reasons to enforce consistency include, but are not limited to:

    - naming conventions can help you understand the purpose of a word or
    variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes >>>> the purpose of the code more clear

    - you work with others on the same code-base; consistency means less
    time trying to unravel others' code

    - working with a set of rules means you spend less time working out
    naming / spacing / commenting conventions, and just follow the script in >>>> your head

    - consistent spacing rules make the layout of the code easier to follow. >>>>
    etc...

    You are talking about being consistent in specific purposes. Naming conventions have some rationale.

    My point is that I haven't heard anyone make a rationale regarding the issue of when to let data remain on the stack.
    One 'rule' I frequently seem to run into trouble with is ordering of addresses
    and counts - specifically CMOVE et al. Gut feeling is it should have been
    ( src len dest ) but I've never been motivated enough to do the work to prove/
    disprove it. I figure that's a job for academics.

    I have nearly zero knowledge of optimizations, but it would seem to me this is the sort of thing that can be optimized by the tools. Write the code how you want, and let the tools arrange the assembly code to minimize stack juggling. In the end, most
    Forth code runs on a register CPU, no?

    AFAIK optimizers are still a long way from being able handle anything thrown at them.
    If a programmer is serious he'll want to improve his game; if he's not I doubt he
    cares what comes out the end.

    I did some work on an indexed stack machine instruction set. It could dig some small number of locations down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack instructions. The test case was an
    interrupt routine to manage a DDS NCO. I think there were three parameters on the stack and of course, the current phase value. I believe the cycle count dropped from 80 to 50 or something equivalent. I have no idea how to write an optimizing Forth
    compiler. But I think it could have been very fast, for the number of gates used. But then, some of the processors on Jim Brakefield's list are very impressive and likely hard to beat. However, there is no actual benchmark numbers. He counts
    instructions per second and per LUT, without comparing how effective the instructions are, if I'm not mistaken.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From S Jack@21:1/5 to dxforth on Thu Apr 27 05:30:45 2023
    On Wednesday, April 26, 2023 at 4:59:16 AM UTC-5, dxforth wrote:
    The application has criteria. I'm not sure the programmer does.

    Your're beating a dead horse. It's simply a matter
    of one's purpose. If your doing standards or need
    crutches for clarity, you do conventions. If you
    do CM style, word behavior is only fixed in the
    context of the application where it's applied.
    --
    me

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to S Jack on Thu Apr 27 23:14:00 2023
    On 27/04/2023 10:30 pm, S Jack wrote:
    On Wednesday, April 26, 2023 at 4:59:16 AM UTC-5, dxforth wrote:
    The application has criteria. I'm not sure the programmer does.

    Your're beating a dead horse. It's simply a matter
    of one's purpose. If your doing standards or need
    crutches for clarity, you do conventions. If you
    do CM style, word behavior is only fixed in the
    context of the application where it's applied.

    Do you have an example that demonstrates your point?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Hendrix@21:1/5 to minforth on Thu Apr 27 05:47:50 2023
    On Thursday, April 27, 2023 at 11:12:09 AM UTC+2, minforth wrote:
    Lorem Ipsum schrieb am Donnerstag, 27. April 2023 um 03:41:33 UTC+2:
    I did some work on an indexed stack machine instruction set. It could dig some small number of locations
    down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack
    instructions.
    It's an old questionable thing. Simple demo case subtraction:
    : Mb ( a b -- diff b ) tuck - swap ;
    With a word called UP (to step up the stack pointer):
    : Mb ( a b -- diff b ) - up ;
    Microscopic improvement and unportable.

    FORTH> : Mb ( a b -- diff b ) tuck - swap ;
    FORTH> ' Mb idis
    $0133DC80 : Mb
    $0133DC8A pop rbx
    $0133DC8B pop rdi
    $0133DC8C sub rdi, rbx
    $0133DC8F push rdi
    $0133DC90 push rbx
    $0133DC91 ;

    FORTH> : Mb2 ( a b -- diff b ) DUP >R - R> ; ' Mb2 idis
    $01340540 : Mb2
    $0134054A pop rbx
    $0134054B pop rdi
    $0134054C sub rdi, rbx
    $0134054F push rdi
    $01340550 push rbx
    $01340551 ;

    and

    FORTH> : test 125 dup 25 Mb Mb2 . ; ok
    FORTH> see test
    Flags: ANSI
    $013405C0 : test
    $013405CA push #125 b#
    $013405CC push #75 b#
    $013405CE push #25 b#
    $013405D0 jmp .+10 ( $0124A102 ) offset NEAR
    $013405D5 ;

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@21:1/5 to Marcel Hendrix on Thu Apr 27 06:19:02 2023
    Marcel Hendrix schrieb am Donnerstag, 27. April 2023 um 14:47:51 UTC+2:
    On Thursday, April 27, 2023 at 11:12:09 AM UTC+2, minforth wrote:
    Lorem Ipsum schrieb am Donnerstag, 27. April 2023 um 03:41:33 UTC+2:
    I did some work on an indexed stack machine instruction set. It could dig some small number of locations
    down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack
    instructions.
    It's an old questionable thing. Simple demo case subtraction:
    : Mb ( a b -- diff b ) tuck - swap ;
    With a word called UP (to step up the stack pointer):
    : Mb ( a b -- diff b ) - up ;
    Microscopic improvement and unportable.
    FORTH> : Mb ( a b -- diff b ) tuck - swap ;
    FORTH> ' Mb idis
    $0133DC80 : Mb
    $0133DC8A pop rbx
    $0133DC8B pop rdi
    $0133DC8C sub rdi, rbx
    $0133DC8F push rdi
    $0133DC90 push rbx
    $0133DC91 ;

    FORTH> : Mb2 ( a b -- diff b ) DUP >R - R> ; ' Mb2 idis
    $01340540 : Mb2
    $0134054A pop rbx
    $0134054B pop rdi
    $0134054C sub rdi, rbx
    $0134054F push rdi
    $01340550 push rbx
    $01340551 ;

    and

    FORTH> : test 125 dup 25 Mb Mb2 . ; ok
    FORTH> see test
    Flags: ANSI
    $013405C0 : test
    $013405CA push #125 b#
    $013405CC push #75 b#
    $013405CE push #25 b#
    $013405D0 jmp .+10 ( $0124A102 ) offset NEAR
    $013405D5 ;

    Your compiler is an admirable achievement.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to S Jack on Thu Apr 27 08:37:22 2023
    On Thursday, April 27, 2023 at 8:30:46 AM UTC-4, S Jack wrote:
    On Wednesday, April 26, 2023 at 4:59:16 AM UTC-5, dxforth wrote:
    The application has criteria. I'm not sure the programmer does.
    Your're beating a dead horse. It's simply a matter
    of one's purpose. If your doing standards or need
    crutches for clarity, you do conventions. If you
    do CM style, word behavior is only fixed in the
    context of the application where it's applied.

    What is CM style??? Country Manners? Counter Mass? Computer Mouse?

    --

    Rick C.

    --+ Get 1,000 miles of free Supercharging
    --+ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to minforth on Thu Apr 27 08:40:12 2023
    On Thursday, April 27, 2023 at 5:12:09 AM UTC-4, minforth wrote:
    Lorem Ipsum schrieb am Donnerstag, 27. April 2023 um 03:41:33 UTC+2:
    I did some work on an indexed stack machine instruction set. It could dig some small number of locations down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack instructions.
    It's an old questionable thing. Simple demo case subtraction:
    : Mb ( a b -- diff b ) tuck - swap ;
    With a word called UP (to step up the stack pointer):
    : Mb ( a b -- diff b ) - up ;
    Microscopic improvement and unportable.

    You aren't getting the concept. But that's ok. This isn't Forth code I'm talking about. This is a stack CPU instruction set. They are virtually never the same thing.

    --

    Rick C.

    -+- Get 1,000 miles of free Supercharging
    -+- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Marcel Hendrix on Thu Apr 27 08:50:51 2023
    On Thursday, April 27, 2023 at 8:47:51 AM UTC-4, Marcel Hendrix wrote:
    On Thursday, April 27, 2023 at 11:12:09 AM UTC+2, minforth wrote:
    Lorem Ipsum schrieb am Donnerstag, 27. April 2023 um 03:41:33 UTC+2:
    I did some work on an indexed stack machine instruction set. It could dig some small number of locations
    down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack
    instructions.
    It's an old questionable thing. Simple demo case subtraction:
    : Mb ( a b -- diff b ) tuck - swap ;
    With a word called UP (to step up the stack pointer):
    : Mb ( a b -- diff b ) - up ;
    Microscopic improvement and unportable.
    FORTH> : Mb ( a b -- diff b ) tuck - swap ;
    FORTH> ' Mb idis
    $0133DC80 : Mb
    $0133DC8A pop rbx
    $0133DC8B pop rdi
    $0133DC8C sub rdi, rbx
    $0133DC8F push rdi
    $0133DC90 push rbx
    $0133DC91 ;

    FORTH> : Mb2 ( a b -- diff b ) DUP >R - R> ; ' Mb2 idis
    $01340540 : Mb2
    $0134054A pop rbx
    $0134054B pop rdi
    $0134054C sub rdi, rbx
    $0134054F push rdi
    $01340550 push rbx
    $01340551 ;

    and

    FORTH> : test 125 dup 25 Mb Mb2 . ; ok
    FORTH> see test
    Flags: ANSI
    $013405C0 : test
    $013405CA push #125 b#
    $013405CC push #75 b#
    $013405CE push #25 b#
    $013405D0 jmp .+10 ( $0124A102 ) offset NEAR
    $013405D5 ;

    -marcel

    I am by no means fluent with x86 assembly (unless this is ARM assembly with I am even less fluent with), but why don't you keep TOS in a register? Is this faster? Four instructions to move data, with only one instruction performing useful work seems
    awkward, to say the least. Am I simply not getting something?

    --

    Rick C.

    +-- Get 1,000 miles of free Supercharging
    +-- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Thu Apr 27 08:46:16 2023
    On Thursday, April 27, 2023 at 6:57:15 AM UTC-4, dxforth wrote:
    On 27/04/2023 11:41 am, Lorem Ipsum wrote:
    On Wednesday, April 26, 2023 at 8:56:00 PM UTC-4, dxforth wrote:
    On 25/04/2023 4:10 pm, Lorem Ipsum wrote:
    On Tuesday, April 25, 2023 at 12:31:06 AM UTC-4, Ron AARON wrote:
    ...
    Some reasons to enforce consistency include, but are not limited to: >>>>
    - naming conventions can help you understand the purpose of a word or >>>> variable without needing to refer to documentation

    - when you return to the code after an extended absence, the above makes
    the purpose of the code more clear

    - you work with others on the same code-base; consistency means less >>>> time trying to unravel others' code

    - working with a set of rules means you spend less time working out >>>> naming / spacing / commenting conventions, and just follow the script in
    your head

    - consistent spacing rules make the layout of the code easier to follow.

    etc...

    You are talking about being consistent in specific purposes. Naming conventions have some rationale.

    My point is that I haven't heard anyone make a rationale regarding the issue of when to let data remain on the stack.
    One 'rule' I frequently seem to run into trouble with is ordering of addresses
    and counts - specifically CMOVE et al. Gut feeling is it should have been >> ( src len dest ) but I've never been motivated enough to do the work to prove/
    disprove it. I figure that's a job for academics.

    I have nearly zero knowledge of optimizations, but it would seem to me this is the sort of thing that can be optimized by the tools. Write the code how you want, and let the tools arrange the assembly code to minimize stack juggling. In the end, most
    Forth code runs on a register CPU, no?
    AFAIK optimizers are still a long way from being able handle anything thrown at them.
    If a programmer is serious he'll want to improve his game; if he's not I doubt he
    cares what comes out the end.
    I did some work on an indexed stack machine instruction set. It could dig some small number of locations down into the stack, and I think it could index upward a bit too. I found it could eliminate a *lot* of stack instructions. The test case was an
    interrupt routine to manage a DDS NCO. I think there were three parameters on the stack and of course, the current phase value. I believe the cycle count dropped from 80 to 50 or something equivalent. I have no idea how to write an optimizing Forth
    compiler. But I think it could have been very fast, for the number of gates used. But then, some of the processors on Jim Brakefield's list are very impressive and likely hard to beat. However, there is no actual benchmark numbers. He counts instructions
    per second and per LUT, without comparing how effective the instructions are, if I'm not mistaken.

    One of us doesn't understand optimizers. My understanding is they have virtually nothing to do with the written code, and everything to do with the compiled code. Optimizers optimize the compiled code.

    A lot of people can't get out of the mindset that a stack CPU is a Forth CPU. That's simply not true. Code for a stack CPU has to be generated from source code, the same way as for any other CPU. After the code generator does its thing, the optimizer
    can do its thing. I'm sure implementations combine the two to some degree, but this is not about how people code. It's about the code the compiler produces.

    That's why I wrote, "I have no idea how to write an optimizing Forth compiler."

    --

    Rick C.

    -++ Get 1,000 miles of free Supercharging
    -++ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Hendrix@21:1/5 to Lorem Ipsum on Thu Apr 27 09:25:49 2023
    On Thursday, April 27, 2023 at 5:50:52 PM UTC+2, Lorem Ipsum wrote:
    On Thursday, April 27, 2023 at 8:47:51 AM UTC-4, Marcel Hendrix wrote:
    On Thursday, April 27, 2023 at 11:12:09 AM UTC+2, minforth wrote:
    Lorem Ipsum schrieb am Donnerstag, 27. April 2023 um 03:41:33 UTC+2:
    [..]
    FORTH> : test 125 dup 25 Mb Mb2 . ; ok
    FORTH> see test
    Flags: ANSI
    $013405C0 : test
    $013405CA push #125 b#
    $013405CC push #75 b#
    $013405CE push #25 b#
    $013405D0 jmp .+10 ( $0124A102 ) offset NEAR
    $013405D5 ;
    [..]
    I am by no means fluent with x86 assembly (unless this is ARM assembly
    with I am even less fluent with), but why don't you keep TOS in a register? Is this faster? Four instructions to move data, with only one instruction performing useful work seems awkward, to say the least.

    The compiler knows that the user expects input to come from
    the Forth stack and output to go there. Therefore each words begins
    with popping the relevant stack, and ends with pushing something
    back on it.
    When words are strung together from other words, it happens
    that some intermediate inputs/results can not be inspected by the
    user, and such inputs/results thus don't need pops and pushes. E.g.,

    : demo 3 5 + 2* 8 / drop ;
    FORTH> ' demo idis
    $0133DC80 : demo
    $0133DC8A ;
    ... generates an empty word because there is no input and no output.

    FORTH> : demo2 3 5 + 2* 8 / ; ok
    FORTH> ' demo2 idis
    $01340500 : demo2
    $0134050A push 2 b#
    $0134050C ;
    ... simply pushes 2 on the stack and

    FORTH> : demo3 ( a b -- c ) + 2* 8 / ; ' demo3 idis
    $01340580 : demo3
    $0134058A pop rbx
    $0134058B pop rdi
    $0134058C lea rbx, [rdi rbx*1] qword
    $01340590 lea rbx, [rbx*2 0 +] qword
    $01340598 sar rbx, 3 b#
    $0134059C push rbx
    $0134059D ;
    ... needs to both pop and push the Forth stack. However,

    FORTH> : demo4 3 5 demo3 ; ' demo4 idis
    $01340600 : demo4
    $0134060A push 2 b#
    $0134060C ;
    ... analyzes the combination of demo3 and the popping of
    the two literals and optimizes that to a single push again.

    Normally, words that do something useful don't have any
    significant stack traffic inside.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to S Jack on Thu Apr 27 16:58:45 2023
    S Jack <sdwjack69@gmail.com> writes:
    If you
    do CM style, word behavior is only fixed in the=20
    context of the application where it's applied.

    I assume you mean Chuck Moore. It seems to me that he usually sticks
    to consuming the arguments; that includes the word IF. He replaced
    the consuming IF with a non-consuming IF in machine Forth <http://www.figuk.plus.com/articles/issue106.pdf#page=29>. It's not
    clear that this was driven by application needs; it's just as
    plausible that it was driven by implementation simplicity.

    Apart from this change, the rest of Machine Forth is pretty much in
    the consuming camp. The only other exception is +*, the multiply
    step.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Fri Apr 28 03:31:08 2023
    On 28/04/2023 1:46 am, Lorem Ipsum wrote:

    One of us doesn't understand optimizers. My understanding is they have virtually nothing to do with the written code, and everything to do with the compiled code. Optimizers optimize the compiled code.

    A lot of people can't get out of the mindset that a stack CPU is a Forth CPU. That's simply not true. Code for a stack CPU has to be generated from source code, the same way as for any other CPU. After the code generator does its thing, the
    optimizer can do its thing. I'm sure implementations combine the two to some degree, but this is not about how people code. It's about the code the compiler produces.

    That's why I wrote, "I have no idea how to write an optimizing Forth compiler."

    One of us doesn't understand Forth. In Forth the programmer is the compiler/optimizer.
    His role is to minimize stack operations so that the stack machine has less to do. The
    idea that the programmer should be free to code in a way that pleases him (e.g. locals)
    because there's a gcc-style compiler/optimizer under the hood misses the point of Forth.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Thu Apr 27 12:48:54 2023
    On Thursday, April 27, 2023 at 1:31:12 PM UTC-4, dxforth wrote:
    On 28/04/2023 1:46 am, Lorem Ipsum wrote:

    One of us doesn't understand optimizers. My understanding is they have virtually nothing to do with the written code, and everything to do with the compiled code. Optimizers optimize the compiled code.

    A lot of people can't get out of the mindset that a stack CPU is a Forth CPU. That's simply not true. Code for a stack CPU has to be generated from source code, the same way as for any other CPU. After the code generator does its thing, the optimizer
    can do its thing. I'm sure implementations combine the two to some degree, but this is not about how people code. It's about the code the compiler produces.

    That's why I wrote, "I have no idea how to write an optimizing Forth compiler."
    One of us doesn't understand Forth. In Forth the programmer is the compiler/optimizer.
    His role is to minimize stack operations so that the stack machine has less to do. The
    idea that the programmer should be free to code in a way that pleases him (e.g. locals)
    because there's a gcc-style compiler/optimizer under the hood misses the point of Forth.

    I guess I didn't understand. So Forth compilers don't optimize code? You need to explain that to a few Forth compiler writers, that are doing it wrong.

    As to the code banger minimizing stack ops, that's not what my idea is about. It's about eliminating stack ops the programmer can't get rid of. I realize you don't understand this, but the point is this can make the stack CPU work like a register CPU,
    by only deleting operands as the instruction indicates. I just realized this is a bit analogous to combining the return instruction with every instruction. This makes the DROP or DUP or SWAP a part of the current instruction.

    In a standard stack CPU, an add deletes the input operands. In this stack indexing CPU, one, the other or both operands can be saved and used in the next operation. The only conflict I had was in the opcode design. I'm always thinking in terms of the
    resources available in an FPGA and trying to minimize instruction word size. I should probably not worry with that, and iron out the issues in the instruction design. Then worry with opcode design. Still, the reduction in instruct count (same as cycle
    count) was large.

    Next time I use an FPGA CPU, I want to return to that and see where I can go with it. I might need to get into Forth compiler design to see if I can write an optimizing compiler for it. Otherwise, I would just continue to write in the native assembly
    language.

    --

    Rick C.

    +-+ Get 1,000 miles of free Supercharging
    +-+ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Thu Apr 27 17:56:06 2023
    On Thursday, April 27, 2023 at 8:46:43 PM UTC-4, dxforth wrote:
    On 28/04/2023 5:48 am, Lorem Ipsum wrote:
    On Thursday, April 27, 2023 at 1:31:12 PM UTC-4, dxforth wrote:
    On 28/04/2023 1:46 am, Lorem Ipsum wrote:

    One of us doesn't understand optimizers. My understanding is they have virtually nothing to do with the written code, and everything to do with the compiled code. Optimizers optimize the compiled code.

    A lot of people can't get out of the mindset that a stack CPU is a Forth CPU. That's simply not true. Code for a stack CPU has to be generated from source code, the same way as for any other CPU. After the code generator does its thing, the
    optimizer can do its thing. I'm sure implementations combine the two to some degree, but this is not about how people code. It's about the code the compiler produces.

    That's why I wrote, "I have no idea how to write an optimizing Forth compiler."
    One of us doesn't understand Forth. In Forth the programmer is the compiler/optimizer.
    His role is to minimize stack operations so that the stack machine has less to do. The
    idea that the programmer should be free to code in a way that pleases him (e.g. locals)
    because there's a gcc-style compiler/optimizer under the hood misses the point of Forth.

    I guess I didn't understand. So Forth compilers don't optimize code? You need to explain that to a few Forth compiler writers, that are doing it wrong.
    No, they don't attempt to optimize what the programmer wrote - at least not those that
    try to remain true to Moore's view that the programmer needs to stay in control. If
    I can't influence the code generated, what need is there to expose me to a stack and
    operators. I may just as well use another language - one that hides all the internals.

    Ok, feel free to not use optimizers. You can typically turn them off.

    I think you objection is without basis. You seem to be objecting to the concept of optimization in compiled code. What sort of control are you looking for, that you lose with Forth? Every compiled language ignores the "control", other than
    implementing the functionality of the source code. Try looking at an HDL. It's very hard to try to control the hardware produced. Rather, the functionality is "described" by the code, and the tool is free to implement this functionality as works best.


    I know in C, there are features to not optimize certain features. It's been too long for me to recall, but there are keywords to tell the tools to not much with this, maybe I'm thinking of "volatile"?

    Whatever. I really don't see your objection. Optimization is very common and typically desirable for the performance and size advantages.

    --

    Rick C.

    ++- Get 1,000 miles of free Supercharging
    ++- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Fri Apr 28 10:46:41 2023
    On 28/04/2023 5:48 am, Lorem Ipsum wrote:
    On Thursday, April 27, 2023 at 1:31:12 PM UTC-4, dxforth wrote:
    On 28/04/2023 1:46 am, Lorem Ipsum wrote:

    One of us doesn't understand optimizers. My understanding is they have virtually nothing to do with the written code, and everything to do with the compiled code. Optimizers optimize the compiled code.

    A lot of people can't get out of the mindset that a stack CPU is a Forth CPU. That's simply not true. Code for a stack CPU has to be generated from source code, the same way as for any other CPU. After the code generator does its thing, the optimizer
    can do its thing. I'm sure implementations combine the two to some degree, but this is not about how people code. It's about the code the compiler produces.

    That's why I wrote, "I have no idea how to write an optimizing Forth compiler."
    One of us doesn't understand Forth. In Forth the programmer is the compiler/optimizer.
    His role is to minimize stack operations so that the stack machine has less to do. The
    idea that the programmer should be free to code in a way that pleases him (e.g. locals)
    because there's a gcc-style compiler/optimizer under the hood misses the point of Forth.

    I guess I didn't understand. So Forth compilers don't optimize code? You need to explain that to a few Forth compiler writers, that are doing it wrong.

    No, they don't attempt to optimize what the programmer wrote - at least not those that
    try to remain true to Moore's view that the programmer needs to stay in control. If
    I can't influence the code generated, what need is there to expose me to a stack and
    operators. I may just as well use another language - one that hides all the internals.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Fri Apr 28 12:24:59 2023
    On 28/04/2023 10:56 am, Lorem Ipsum wrote:
    On Thursday, April 27, 2023 at 8:46:43 PM UTC-4, dxforth wrote:
    On 28/04/2023 5:48 am, Lorem Ipsum wrote:
    On Thursday, April 27, 2023 at 1:31:12 PM UTC-4, dxforth wrote:
    On 28/04/2023 1:46 am, Lorem Ipsum wrote:

    One of us doesn't understand optimizers. My understanding is they have virtually nothing to do with the written code, and everything to do with the compiled code. Optimizers optimize the compiled code.

    A lot of people can't get out of the mindset that a stack CPU is a Forth CPU. That's simply not true. Code for a stack CPU has to be generated from source code, the same way as for any other CPU. After the code generator does its thing, the
    optimizer can do its thing. I'm sure implementations combine the two to some degree, but this is not about how people code. It's about the code the compiler produces.

    That's why I wrote, "I have no idea how to write an optimizing Forth compiler."
    One of us doesn't understand Forth. In Forth the programmer is the compiler/optimizer.
    His role is to minimize stack operations so that the stack machine has less to do. The
    idea that the programmer should be free to code in a way that pleases him (e.g. locals)
    because there's a gcc-style compiler/optimizer under the hood misses the point of Forth.

    I guess I didn't understand. So Forth compilers don't optimize code? You need to explain that to a few Forth compiler writers, that are doing it wrong.
    No, they don't attempt to optimize what the programmer wrote - at least not those that
    try to remain true to Moore's view that the programmer needs to stay in control. If
    I can't influence the code generated, what need is there to expose me to a stack and
    operators. I may just as well use another language - one that hides all the internals.

    Ok, feel free to not use optimizers. You can typically turn them off.

    I think you objection is without basis. You seem to be objecting to the concept of optimization in compiled code. What sort of control are you looking for, that you lose with Forth? Every compiled language ignores the "control", other than
    implementing the functionality of the source code.

    Scattered throughout VFX code one finds code generator switches being enacted. That's
    the Forth programmer intervening. This suggests Forth programmers aren't willing to
    give optimizers free reign.

    Try looking at an HDL. It's very hard to try to control the hardware produced. Rather, the functionality is "described" by the code, and the tool is free to implement this functionality as works best.

    I can't speak to any of that or how it came to be. What I try to do is see where Forth is
    coming from so as not to inadvertently scuttle its 'raison d'etre'.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Fri Apr 28 00:05:57 2023
    On Thursday, April 27, 2023 at 10:25:01 PM UTC-4, dxforth wrote:
    On 28/04/2023 10:56 am, Lorem Ipsum wrote:
    On Thursday, April 27, 2023 at 8:46:43 PM UTC-4, dxforth wrote:
    On 28/04/2023 5:48 am, Lorem Ipsum wrote:
    On Thursday, April 27, 2023 at 1:31:12 PM UTC-4, dxforth wrote:
    On 28/04/2023 1:46 am, Lorem Ipsum wrote:

    One of us doesn't understand optimizers. My understanding is they have virtually nothing to do with the written code, and everything to do with the compiled code. Optimizers optimize the compiled code.

    A lot of people can't get out of the mindset that a stack CPU is a Forth CPU. That's simply not true. Code for a stack CPU has to be generated from source code, the same way as for any other CPU. After the code generator does its thing, the
    optimizer can do its thing. I'm sure implementations combine the two to some degree, but this is not about how people code. It's about the code the compiler produces.

    That's why I wrote, "I have no idea how to write an optimizing Forth compiler."
    One of us doesn't understand Forth. In Forth the programmer is the compiler/optimizer.
    His role is to minimize stack operations so that the stack machine has less to do. The
    idea that the programmer should be free to code in a way that pleases him (e.g. locals)
    because there's a gcc-style compiler/optimizer under the hood misses the point of Forth.

    I guess I didn't understand. So Forth compilers don't optimize code? You need to explain that to a few Forth compiler writers, that are doing it wrong.
    No, they don't attempt to optimize what the programmer wrote - at least not those that
    try to remain true to Moore's view that the programmer needs to stay in control. If
    I can't influence the code generated, what need is there to expose me to a stack and
    operators. I may just as well use another language - one that hides all the internals.

    Ok, feel free to not use optimizers. You can typically turn them off.

    I think you objection is without basis. You seem to be objecting to the concept of optimization in compiled code. What sort of control are you looking for, that you lose with Forth? Every compiled language ignores the "control", other than
    implementing the functionality of the source code.
    Scattered throughout VFX code one finds code generator switches being enacted. That's
    the Forth programmer intervening. This suggests Forth programmers aren't willing to
    give optimizers free reign.

    Yes, and...?


    Try looking at an HDL. It's very hard to try to control the hardware produced. Rather, the functionality is "described" by the code, and the tool is free to implement this functionality as works best.
    I can't speak to any of that or how it came to be. What I try to do is see where Forth is
    coming from so as not to inadvertently scuttle its 'raison d'etre'.

    I don't know that I've ever programed anything, while giving thought to the language's 'raison d'etre'. Nope, I went through my notes, and that's just not part of the specifications for the code.

    I don't know what you are trying to say at this point. You seem to be a leaf in the wind. Since there's no coherent thoughts being expressed, I guess we are done.

    --

    Rick C.

    +++ Get 1,000 miles of free Supercharging
    +++ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Fri Apr 28 06:53:53 2023
    dxforth <dxforth@gmail.com> writes:
    Scattered throughout VFX code one finds code generator switches being >enacted. That's the Forth programmer intervening. This suggests
    Forth programmers aren't willing to give optimizers free reign.

    It suggests that the "optimizer" does not implement the language
    variant that the code is written in. As an example, AFAIK return-address-manipulating code is incompatible with VFX's inlining.
    So if you have code that manipulates return addresses, turning off
    inlining is a (somewhat blunt) way to tell that to the compiler.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to gnuarm.deletethisbit@gmail.com on Fri Apr 28 12:07:25 2023
    In article <5a137452-9b42-4612-822d-eef58cbee3b8n@googlegroups.com>,
    Lorem Ipsum <gnuarm.deletethisbit@gmail.com> wrote:
    In a standard stack CPU, an add deletes the input operands.

    In the prevailing instruction sets RISCV and ARM
    the most common instruction is of the kind
    R1 := R2 <op> R3

    Rick C.
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to none albert on Fri Apr 28 03:52:15 2023
    On Friday, April 28, 2023 at 6:07:28 AM UTC-4, none albert wrote:
    In article <5a137452-9b42-4612...@googlegroups.com>,
    Lorem Ipsum <gnuarm.del...@gmail.com> wrote:
    In a standard stack CPU, an add deletes the input operands.
    In the prevailing instruction sets RISCV and ARM
    the most common instruction is of the kind
    R1 := R2 <op> R3

    And what is your point? I'm not following.

    --

    Rick C.

    ---- Get 1,000 miles of free Supercharging
    ---- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Fri Apr 28 16:42:50 2023
    dxforth <dxforth@gmail.com> writes:
    No, they don't attempt to optimize what the programmer wrote - at
    least not those that try to remain true to Moore's view that the
    programmer needs to stay in control. If I can't influence the code >generated, what need is there to expose me to a stack and operators.

    The stack and operators are there for expressing what you want to
    achieve.

    As for influencing the generated code, let's look at what gforth-fast
    generates for RISC-V for

    : foo swap ! ;

    A B
    ld s0,$8(s8) ld a5,$8(s8)
    addi s10,s10,8 addi s10,s10,8
    addi s8,s8,8 sd s7,$8(s8)
    sd s7,$0(s0) mv s7,a5
    addi s10,s10,8 ld a5,$8(s8)
    ld s7,$8(s8) addi s8,s8,10
    addi s8,s8,8 addi s10,s10,8
    ld a6,$0(s2) sd a5,$0(s7)
    addi s2,s2,8 ld s7,$0(s8)
    addi s10,a6,$8 ld a6,$0(s2)
    ld a4,$-8(s10) addi s2,s2,8
    jr a4 addi s10,a6,$8
    ld a4,$-8(s10)
    jr a4

    A is the code with stack caching, B without (and without static superinstructions). Does B give you better control? How?

    My view is that in an implementation on a register machine, the ideal
    is that in the usual case stack items and locals are in registers.

    OTOH, in a more traditional system most or all of the stacks is in
    memory with a stack pointer pointing to the top-of-stack; maybe the top-of-stack is in a register (variant B above is of that kind). But
    how does that give you more control? If I want to get rid of all the
    loads from and stores to the stack, and the stack pointer updates,
    these systems don't give me a way to do it in Forth. I.e., no
    control.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Fri Apr 28 19:22:09 2023
    dxforth <dxforth@gmail.com> writes:
    One 'rule' I frequently seem to run into trouble with is ordering of addresses >and counts - specifically CMOVE et al. Gut feeling is it should have been
    ( src len dest )

    That suggests that you write the source string into the dest buffer no
    matter how long the buffer is.

    An alternative would be

    ( src srclen dest destlen -- )

    where destlen tells how much space there is in the destination buffer.
    But what to do if srclen>destlen? Exception? Or silently only copy
    destlen chars to dest?

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Sat Apr 29 11:35:35 2023
    On 28/04/2023 4:53 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    Scattered throughout VFX code one finds code generator switches being
    enacted. That's the Forth programmer intervening. This suggests
    Forth programmers aren't willing to give optimizers free reign.

    It suggests that the "optimizer" does not implement the language
    variant that the code is written in. As an example, AFAIK return-address-manipulating code is incompatible with VFX's inlining.
    So if you have code that manipulates return addresses, turning off
    inlining is a (somewhat blunt) way to tell that to the compiler.

    Presumably this has been discussed and debated before. What were the conclusions?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Sat Apr 29 12:43:10 2023
    On 29/04/2023 5:22 am, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    One 'rule' I frequently seem to run into trouble with is ordering of addresses
    and counts - specifically CMOVE et al. Gut feeling is it should have been >> ( src len dest )

    That suggests that you write the source string into the dest buffer no
    matter how long the buffer is.

    That's true of any primitive.

    An alternative would be

    ( src srclen dest destlen -- )

    where destlen tells how much space there is in the destination buffer.
    But what to do if srclen>destlen? Exception? Or silently only copy
    destlen chars to dest?

    It's a complication I've thus far not needed. Should it arise I imagine
    I'd do the test first and then pass to a primitive move as necessary.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Sat Apr 29 13:25:43 2023
    On 28/04/2023 5:05 pm, Lorem Ipsum wrote:

    I don't know that I've ever programed anything, while giving thought to the language's 'raison d'etre'. Nope, I went through my notes, and that's just not part of the specifications for the code.

    I don't know what you are trying to say at this point. You seem to be a leaf in the wind. Since there's no coherent thoughts being expressed, I guess we are done.

    Before you go you might explain what is your rationale for using Forth over other languages?
    It can't be that you accept Moore's reasons for it, because clearly you don't.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Fri Apr 28 21:47:29 2023
    On Friday, April 28, 2023 at 11:25:46 PM UTC-4, dxforth wrote:
    On 28/04/2023 5:05 pm, Lorem Ipsum wrote:

    I don't know that I've ever programed anything, while giving thought to the language's 'raison d'etre'. Nope, I went through my notes, and that's just not part of the specifications for the code.

    I don't know what you are trying to say at this point. You seem to be a leaf in the wind. Since there's no coherent thoughts being expressed, I guess we are done.
    Before you go you might explain what is your rationale for using Forth over other languages?
    It can't be that you accept Moore's reasons for it, because clearly you don't.

    I like it. I find it easier to use than languages that require the more complicated software and hardware. I barely remember how to load code into a target from a C compiler.

    What are you looking for? You don't really seem interested in having much of a conversation. It's like you are always maneuvering to find an advantage point.

    I'll ask again, is there a point you are trying to make? Is there something you wish to discuss?

    --

    Rick C.

    ---+ Get 1,000 miles of free Supercharging
    ---+ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Sat Apr 29 05:24:33 2023
    dxforth <dxforth@gmail.com> writes:
    An alternative would be

    ( src srclen dest destlen -- )

    where destlen tells how much space there is in the destination buffer.
    But what to do if srclen>destlen? Exception? Or silently only copy
    destlen chars to dest?

    It's a complication I've thus far not needed. Should it arise I imagine
    I'd do the test first and then pass to a primitive move as necessary.

    Right. And what would that primitive move look like, say, for the
    truncating variant:

    : safemove ( c-addr1 u1 c-addr2 u2 -- )
    rot umin move ;

    So maybe Moore had this in mind when he designed CMOVE with the stack
    effect ( from to count -- ).

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Sat Apr 29 17:42:50 2023
    On 29/04/2023 3:24 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    An alternative would be

    ( src srclen dest destlen -- )

    where destlen tells how much space there is in the destination buffer.
    But what to do if srclen>destlen? Exception? Or silently only copy
    destlen chars to dest?

    It's a complication I've thus far not needed. Should it arise I imagine
    I'd do the test first and then pass to a primitive move as necessary.

    Right. And what would that primitive move look like, say, for the
    truncating variant:

    : safemove ( c-addr1 u1 c-addr2 u2 -- )
    rot umin move ;

    So maybe Moore had this in mind when he designed CMOVE with the stack
    effect ( from to count -- ).

    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Sat Apr 29 20:42:47 2023
    On 29/04/2023 7:32 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    On 29/04/2023 3:24 pm, Anton Ertl wrote:
    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE.

    Looking at the data from <https://www.complang.tuwien.ac.at/forth/peep/sorted>:

    sum cross gs prims2x
    [a4:~/pub/forth/peep:91748] awk 'NF==6 && $6=="move" {print}' sorted
    7825 7648 72 105 r> move
    3472 1898 561 1013 ;s move
    838 0 191 647 count move
    579 150 225 204 rot move
    70 15 49 6 -rot move
    15 0 15 0 cells move
    1 1 0 0 execute move
    [a4:~/pub/forth/peep:91749] awk 'NF==6 && $6=="cmove" {print}' sorted
    158 28 100 30 swap cmove
    61 4 36 21 r@ cmove
    15 0 15 0 cells cmove

    The numbers are dynamic execution counts. So we have no "SWAP MOVE"
    and no "MIN MOVE" in these runs, but we have some "SWAP CMOVE". OTOH,
    we also have ";S MOVE", "COUNT MOVE", "CELLS MOVE", "EXECUTE MOVE",
    "CELLS CMOVE", which would probably require an additional SWAP if the
    order was ( from count to -- ); for the cases where MOVE and CMOVE are preceeded by stack juggling words, I guess one could use the other
    order, and on average the code would have about the same amount of
    stack juggling.

    The existence of "COUNT MOVE" is particularly interesting: You have a
    counted string in the TO buffer, and want to overwrite all its
    characters by characters from the FROM string. Looking for a longer sequence, I see:

    838 0 191 647 ;s var: c! var: count move
    838 0 191 647 count move lit lit ! ;s

    COUNT MOVE caught my eye - can't say I've used it. What is ;S MOVE
    I looked in my gforth dir but could find no matches. There does
    seem to be a great number of R> MOVE which would favour length last
    syntax.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Sat Apr 29 10:50:12 2023
    dxforth <dxforth@gmail.com> writes:
    What is ;S MOVE
    I looked in my gforth dir but could find no matches.

    ;S is the primitive compiled by EXIT and ";". In the source code you
    would see a MOVE preceded by a call to a colon definition or
    DOES>-defined word.

    There does
    seem to be a great number of R> MOVE which would favour length last
    syntax.

    Looking at a longer sequence:

    7825 7648 72 105 >r rot over 1+ r> move

    All the dynamic invocations seem to be due to one occurence in the
    source code:

    : place ( addr len to -- ) \ gforth
    over >r rot over 1+ r> move c! ;

    Let's see how we can write that with SWAPMOVE:

    : place ( addr len to -- ) \ gforth
    2dup 2>r 1+ swapmove 2r> c! ;

    And if it's ok to corrupt the destination string in case of an
    overlap (not the case for the proposed PLACE):

    : place ( addr len to -- ) \ gforth
    2dup c! 1+ swapmove ;

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Sat Apr 29 09:32:50 2023
    dxforth <dxforth@gmail.com> writes:
    On 29/04/2023 3:24 pm, Anton Ertl wrote:
    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE.

    Looking at the data from
    <https://www.complang.tuwien.ac.at/forth/peep/sorted>:

    sum cross gs prims2x
    [a4:~/pub/forth/peep:91748] awk 'NF==6 && $6=="move" {print}' sorted
    7825 7648 72 105 r> move
    3472 1898 561 1013 ;s move
    838 0 191 647 count move
    579 150 225 204 rot move
    70 15 49 6 -rot move
    15 0 15 0 cells move
    1 1 0 0 execute move
    [a4:~/pub/forth/peep:91749] awk 'NF==6 && $6=="cmove" {print}' sorted
    158 28 100 30 swap cmove
    61 4 36 21 r@ cmove
    15 0 15 0 cells cmove

    The numbers are dynamic execution counts. So we have no "SWAP MOVE"
    and no "MIN MOVE" in these runs, but we have some "SWAP CMOVE". OTOH,
    we also have ";S MOVE", "COUNT MOVE", "CELLS MOVE", "EXECUTE MOVE",
    "CELLS CMOVE", which would probably require an additional SWAP if the
    order was ( from count to -- ); for the cases where MOVE and CMOVE are preceeded by stack juggling words, I guess one could use the other
    order, and on average the code would have about the same amount of
    stack juggling.

    The existence of "COUNT MOVE" is particularly interesting: You have a
    counted string in the TO buffer, and want to overwrite all its
    characters by characters from the FROM string. Looking for a longer
    sequence, I see:

    838 0 191 647 ;s var: c! var: count move
    838 0 191 647 count move lit lit ! ;s

    This seems to be due to one static sequence. Looking in the sources
    of gforth-0.3.0, I find:

    : nextname ( c-addr u -- ) \ gforth
    name-too-long?
    nextname-buffer c! ( c-addr )
    nextname-buffer count move
    ['] nextname-header IS (header) ;

    In development Gforth, that is:

    : nextname ( c-addr u -- ) \ gforth
    \g The next defined word will have the name @var{c-addr u}; the
    \g defining word will leave the input stream alone.
    name-too-long? nextname$ $!
    ['] nextname-header IS header-name, ;

    and $! contains not just one, but two occurences of SWAP MOVE:-).

    BTW, This leads us back to your original question: NAME-TOO-LONG? has
    the stack effect ( c-addr u -- c-addr u ); it throws -19 if u is too
    large for a name.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Lorem Ipsum on Sat Apr 29 20:20:14 2023
    On 29/04/2023 2:47 pm, Lorem Ipsum wrote:
    On Friday, April 28, 2023 at 11:25:46 PM UTC-4, dxforth wrote:
    On 28/04/2023 5:05 pm, Lorem Ipsum wrote:

    I don't know that I've ever programed anything, while giving thought to the language's 'raison d'etre'. Nope, I went through my notes, and that's just not part of the specifications for the code.

    I don't know what you are trying to say at this point. You seem to be a leaf in the wind. Since there's no coherent thoughts being expressed, I guess we are done.
    Before you go you might explain what is your rationale for using Forth over other languages?
    It can't be that you accept Moore's reasons for it, because clearly you don't.

    I like it. I find it easier to use than languages that require the more complicated software and hardware. I barely remember how to load code into a target from a C compiler.

    What are you looking for? You don't really seem interested in having much of a conversation. It's like you are always maneuvering to find an advantage point.

    From what I've seen you're no stranger to asking probing questions. When it goes nowhere
    for you, you end it just as you did above.

    Is there something you wish to discuss?

    'like' doesn't offer much scope for discussion, so no.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Sat Apr 29 21:57:41 2023
    On 29/04/2023 8:50 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    What is ;S MOVE
    I looked in my gforth dir but could find no matches.

    ;S is the primitive compiled by EXIT and ";". In the source code you
    would see a MOVE preceded by a call to a colon definition or
    DOES>-defined word.

    There does
    seem to be a great number of R> MOVE which would favour length last
    syntax.

    Looking at a longer sequence:

    7825 7648 72 105 >r rot over 1+ r> move

    All the dynamic invocations seem to be due to one occurence in the
    source code:

    : place ( addr len to -- ) \ gforth
    over >r rot over 1+ r> move c! ;

    Let's see how we can write that with SWAPMOVE:

    : place ( addr len to -- ) \ gforth
    2dup 2>r 1+ swapmove 2r> c! ;

    And if it's ok to corrupt the destination string in case of an
    overlap (not the case for the proposed PLACE):

    : place ( addr len to -- ) \ gforth
    2dup c! 1+ swapmove ;

    Checking my SwiftForth directory:

    3 r@ cmove
    3 r> cmove
    8 rot cmove
    6 cells cmove
    21 swap cmove

    6 r@ move
    1 r> move
    2 rot move
    3 cells move
    8 swap move

    While the results are closer it would appear the current syntax wins.
    OTOH ...

    103 place

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Sat Apr 29 14:35:50 2023
    In article <u2ihpq$2rlsa$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote: >On 29/04/2023 3:24 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    An alternative would be

    ( src srclen dest destlen -- )

    where destlen tells how much space there is in the destination buffer. >>>> But what to do if srclen>destlen? Exception? Or silently only copy
    destlen chars to dest?

    It's a complication I've thus far not needed. Should it arise I imagine >>> I'd do the test first and then pass to a primitive move as necessary.

    Right. And what would that primitive move look like, say, for the
    truncating variant:

    : safemove ( c-addr1 u1 c-addr2 u2 -- )
    rot umin move ;

    So maybe Moore had this in mind when he designed CMOVE with the stack
    effect ( from to count -- ).

    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE.


    Reality check.
    Of the 61 uses of MOVE in my forth library, only 2 'SWAP MOVE' are present. That are $! and $!-BD.
    $!-BD (brain damaged) refers to <256 strings, not recommended.
    $! is a high level reference implementation.
    That word is used often enough and the implementation is awkward
    enough that it is an assembly primitive in the kernel.

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to Anton Ertl on Sat Apr 29 14:29:46 2023
    In article <2023Apr28.212209@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    dxforth <dxforth@gmail.com> writes:
    One 'rule' I frequently seem to run into trouble with is ordering of addresses
    and counts - specifically CMOVE et al. Gut feeling is it should have been >>( src len dest )

    That suggests that you write the source string into the dest buffer no
    matter how long the buffer is.

    An alternative would be

    ( src srclen dest destlen -- )

    where destlen tells how much space there is in the destination buffer.
    But what to do if srclen>destlen? Exception? Or silently only copy
    destlen chars to dest?

    We are talking about primitives here, not candidates for a
    c-library. I'm content with CMOVE, and add side wheels as
    the need arises. For example, in my implementation of the
    MEMORY wordset MOVE / CMOVE is used in a protected environment.
    If CMOVE leads to a crash here, there is forcibly a defect
    in my MEMORY wordset.

    CMOVE is not supposed to emulate the function of a JTAG debugger.

    - anton

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to dxforth on Sat Apr 29 08:45:07 2023
    On Saturday, April 29, 2023 at 6:20:17 AM UTC-4, dxforth wrote:
    On 29/04/2023 2:47 pm, Lorem Ipsum wrote:
    On Friday, April 28, 2023 at 11:25:46 PM UTC-4, dxforth wrote:
    On 28/04/2023 5:05 pm, Lorem Ipsum wrote:

    I don't know that I've ever programed anything, while giving thought to the language's 'raison d'etre'. Nope, I went through my notes, and that's just not part of the specifications for the code.

    I don't know what you are trying to say at this point. You seem to be a leaf in the wind. Since there's no coherent thoughts being expressed, I guess we are done.
    Before you go you might explain what is your rationale for using Forth over other languages?
    It can't be that you accept Moore's reasons for it, because clearly you don't.

    I like it. I find it easier to use than languages that require the more complicated software and hardware. I barely remember how to load code into a target from a C compiler.

    What are you looking for? You don't really seem interested in having much of a conversation. It's like you are always maneuvering to find an advantage point.
    From what I've seen you're no stranger to asking probing questions. When it goes nowhere
    for you, you end it just as you did above.

    I don't "end it" because it's "going nowhere for me". I end it when you stop discussing the topic, just as you have done now.


    Is there something you wish to discuss?
    'like' doesn't offer much scope for discussion, so no.

    Good. Thanks.

    --

    Rick C.

    --+- Get 1,000 miles of free Supercharging
    --+- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to albert on Sun Apr 30 11:43:33 2023
    On 29/04/2023 10:35 pm, albert wrote:
    In article <u2ihpq$2rlsa$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
    ...
    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE.


    Reality check.
    Of the 61 uses of MOVE in my forth library, only 2 'SWAP MOVE' are present.

    So SWAP MOVE did outnumber MIN MOVE ?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Sun Apr 30 09:44:58 2023
    In article <u2kh44$36gsv$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote: >On 29/04/2023 10:35 pm, albert wrote:
    In article <u2ihpq$2rlsa$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
    ...
    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE.


    Reality check.
    Of the 61 uses of MOVE in my forth library, only 2 'SWAP MOVE' are present.

    So SWAP MOVE did outnumber MIN MOVE ?

    MIN MOVE isn't there at all.

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Hendrix@21:1/5 to Anton Ertl on Sun Apr 30 00:22:41 2023
    On Saturday, April 29, 2023 at 12:19:25 PM UTC+2, Anton Ertl wrote:
    dxforth <dxf...@gmail.com> writes:
    On 29/04/2023 3:24 pm, Anton Ertl wrote:
    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE. Looking at the data from <https://www.complang.tuwien.ac.at/forth/peep/sorted>:

    sum cross gs prims2x
    [a4:~/pub/forth/peep:91748] awk 'NF==6 && $6=="move" {print}' sorted
    7825 7648 72 105 r> move
    3472 1898 561 1013 ;s move
    838 0 191 647 count move
    579 150 225 204 rot move
    70 15 49 6 -rot move
    15 0 15 0 cells move
    1 1 0 0 execute move
    [a4:~/pub/forth/peep:91749] awk 'NF==6 && $6=="cmove" {print}' sorted
    158 28 100 30 swap cmove
    61 4 36 21 r@ cmove
    15 0 15 0 cells cmove
    [..]

    A stunning amount of occurences... In the iForth corpus I found much less:

    directories: examples / include / meta
    Searched files: 6701 1182 55 -------------------------------------------------
    Searching for: SWAP CMOVE 55 17 2
    Searching for: ROT CMOVE 11 1 0
    Searching for: MIN CMOVE 4 4 2
    Searching for: R> CMOVE 4 0 0

    Searching for: CELLS MOVE 83 7 1
    Searching for: SWAP MOVE 48 20 6
    Searching for: ROT MOVE 4 0 0
    Searching for: R> MOVE 3 1 0
    Searching for: MAX MOVE 2 2 0

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Marcel Hendrix on Sun Apr 30 18:14:29 2023
    On 30/04/2023 5:22 pm, Marcel Hendrix wrote:

    directories: examples / include / meta
    Searched files: 6701 1182 55 -------------------------------------------------
    Searching for: SWAP CMOVE 55 17 2
    Searching for: ROT CMOVE 11 1 0
    Searching for: MIN CMOVE 4 4 2
    Searching for: R> CMOVE 4 0 0

    Searching for: CELLS MOVE 83 7 1
    Searching for: SWAP MOVE 48 20 6
    Searching for: ROT MOVE 4 0 0
    Searching for: R> MOVE 3 1 0
    Searching for: MAX MOVE 2 2 0

    Without a closer examination of the code it's not clear whether
    a (src len dst) syntax would be problematic. I looked at Albert's
    MOVE and the majority had simple literals as parameters. They
    could have been written either way.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Marcel Hendrix on Sun Apr 30 14:22:19 2023
    Marcel Hendrix <mhx@iae.nl> writes:
    On Saturday, April 29, 2023 at 12:19:25=E2=80=AFPM UTC+2, Anton Ertl wrote:
    dxforth <dxf...@gmail.com> writes:
    On 29/04/2023 3:24 pm, Anton Ertl wrote:
    A frequency analysis would likely show SWAP MOVE outnumbered MIN MOVE.
    Looking at the data from
    <https://www.complang.tuwien.ac.at/forth/peep/sorted>:

    sum cross gs prims2x
    [a4:~/pub/forth/peep:91748] awk 'NF=3D=3D6 && $6=3D=3D"move" {print}' sor= >ted
    7825 7648 72 105 r> move
    3472 1898 561 1013 ;s move
    838 0 191 647 count move
    579 150 225 204 rot move
    70 15 49 6 -rot move
    15 0 15 0 cells move
    1 1 0 0 execute move
    [a4:~/pub/forth/peep:91749] awk 'NF=3D=3D6 && $6=3D=3D"cmove" {print}' so= >rted
    158 28 100 30 swap cmove
    61 4 36 21 r@ cmove
    15 0 15 0 cells cmove
    [..]

    A stunning amount of occurences...

    These are dynamic occurences, i.e., how often the sequence occurs in
    the execution traces of the three programs. For the two sequences
    that I investigated (COUNT MOVE and R> MOVE), there is probably just
    one static occurence that was executed 838 (COUNT MOVE) and 7825 (R>
    MOVE) respectively.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to All on Wed May 3 04:19:53 2023
    In general I'd say - consume them. Just as the doctor ordered (TF). The
    reason for that is simple - often copying stack items (when needed)
    before calling a word is not a major issue.

    The issue becomes a bit more difficult when MANY parameters have
    to be passed - or a certain parameter is buried deep in the stack.

    Another consideration is how often an item is reused after an operation.
    E.g. many times I need the target address after PLACE. It may be my way
    of programming - and when I introduced PLACE I seriously considered it. Eventually choosing compatibility over usability.

    My 2 cents..

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Brian Fox@21:1/5 to Hans Bezemer on Wed May 3 10:19:09 2023
    On Wednesday, May 3, 2023 at 7:19:55 AM UTC-4, Hans Bezemer wrote:

    E.g. many times I need the target address after PLACE.

    For situations like that, with a non-optimizing compiler, I have DUP>R
    which is one instruction on my machine.
    I see that SwiftForth has DUP>R as well.

    Is DUP>R common in other systems?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Hans Bezemer on Thu May 4 13:34:20 2023
    On 3/05/2023 9:19 pm, Hans Bezemer wrote:

    Another consideration is how often an item is reused after an operation.
    E.g. many times I need the target address after PLACE. It may be my way
    of programming - and when I introduced PLACE I seriously considered it. Eventually choosing compatibility over usability.

    Some forths had PACK. As my kernel used it three times vs. one for PLACE,
    I opted to provide both.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Hendrix@21:1/5 to dxforth on Wed May 3 21:57:16 2023
    On Thursday, May 4, 2023 at 5:36:20 AM UTC+2, dxforth wrote:
    On 3/05/2023 9:19 pm, Hans Bezemer wrote:

    Another consideration is how often an item is reused after an operation. E.g. many times I need the target address after PLACE. It may be my way
    of programming - and when I introduced PLACE I seriously considered it. Eventually choosing compatibility over usability.
    Some forths had PACK. As my kernel used it three times vs. one for PLACE,
    I opted to provide both.

    iForth has PACK, too.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Brian Fox on Thu May 4 08:01:58 2023
    Brian Fox <brian.fox@brianfox.ca> writes:
    For situations like that, with a non-optimizing compiler, I have DUP>R=20 >which is one instruction on my machine.
    I see that SwiftForth has DUP>R as well.=20

    Is DUP>R common in other systems?

    Gforth does not have DUP>R as a word, but gforth-fast optimizes DUP >R
    (but not >R R@) into a superinstruction (something like a primitive,
    except that the compiler combines it automatically; SwiftForth uses
    the same technique more extensively). In the thread starting at <2022Mar12.130400@mips.complang.tuwien.ac.at> I present some data on
    how frequent DUP >R and >R R@ are; after converting the >R R@
    occurences to DUP >R, DUP >R is roughly as common in the Gforth image
    as TUCK, half as common as NIP, and 1.5 times as common as -ROT.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to brian.fox@brianfox.ca on Thu May 4 09:55:30 2023
    In article <f54f4ad7-0cc6-486b-8b97-9272cd321b28n@googlegroups.com>,
    Brian Fox <brian.fox@brianfox.ca> wrote:
    On Wednesday, May 3, 2023 at 7:19:55 AM UTC-4, Hans Bezemer wrote:

    E.g. many times I need the target address after PLACE.

    For situations like that, with a non-optimizing compiler, I have DUP>R
    which is one instruction on my machine.
    I see that SwiftForth has DUP>R as well.

    Is DUP>R common in other systems?

    Oh boy, how do I hate "optimisations" like that.
    DUP >R is perfectly portable. If you worry so much about
    speed how about a simple optimiser, keeping your programs portable.

    Groetjes Albert


    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Pelc@21:1/5 to dxforth on Thu May 4 08:29:12 2023
    On 4 May 2023 at 05:34:20 CEST, "dxforth" <dxforth@gmail.com> wrote:

    On 3/05/2023 9:19 pm, Hans Bezemer wrote:

    Another consideration is how often an item is reused after an operation.
    E.g. many times I need the target address after PLACE. It may be my way
    of programming - and when I introduced PLACE I seriously considered it.
    Eventually choosing compatibility over usability.

    Some forths had PACK. As my kernel used it three times vs. one for PLACE,
    I opted to provide both.

    What is PACK ?
    --
    Stephen Pelc, stephen@vfxforth.com
    MicroProcessor Engineering, Ltd. - More Real, Less Time
    133 Hill Lane, Southampton SO15 5AF, England
    tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612,
    +34 649 662 974
    http://www.mpeforth.com - free VFX Forth downloads

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ron AARON@21:1/5 to Brian Fox on Thu May 4 12:49:37 2023
    On 03/05/2023 20:19, Brian Fox wrote:
    On Wednesday, May 3, 2023 at 7:19:55 AM UTC-4, Hans Bezemer wrote:

    E.g. many times I need the target address after PLACE.

    For situations like that, with a non-optimizing compiler, I have DUP>R
    which is one instruction on my machine.
    I see that SwiftForth has DUP>R as well.

    Is DUP>R common in other systems?


    Don't know about common, but 8th has had dup>r for quite a while.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Stephen Pelc on Thu May 4 19:38:33 2023
    On 4/05/2023 6:29 pm, Stephen Pelc wrote:
    On 4 May 2023 at 05:34:20 CEST, "dxforth" <dxforth@gmail.com> wrote:

    On 3/05/2023 9:19 pm, Hans Bezemer wrote:

    Another consideration is how often an item is reused after an operation. >>> E.g. many times I need the target address after PLACE. It may be my way
    of programming - and when I introduced PLACE I seriously considered it.
    Eventually choosing compatibility over usability.

    Some forths had PACK. As my kernel used it three times vs. one for PLACE, >> I opted to provide both.

    What is PACK ?

    Same behaviour as PLACE but leaves the destination address.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Thu May 4 12:53:22 2023
    In article <u2vuep$1pcrl$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote: >On 4/05/2023 6:29 pm, Stephen Pelc wrote:
    On 4 May 2023 at 05:34:20 CEST, "dxforth" <dxforth@gmail.com> wrote:

    On 3/05/2023 9:19 pm, Hans Bezemer wrote:

    Another consideration is how often an item is reused after an operation. >>>> E.g. many times I need the target address after PLACE. It may be my way >>>> of programming - and when I introduced PLACE I seriously considered it. >>>> Eventually choosing compatibility over usability.

    Some forths had PACK. As my kernel used it three times vs. one for PLACE, >>> I opted to provide both.

    What is PACK ?

    Same behaviour as PLACE but leaves the destination address.

    It is a mystery why those same people doesn't invent a !
    that leaves the destination address.

    Groetjes Albert

    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to albert on Thu May 4 21:37:28 2023
    On 4/05/2023 8:53 pm, albert wrote:
    In article <u2vuep$1pcrl$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
    On 4/05/2023 6:29 pm, Stephen Pelc wrote:
    On 4 May 2023 at 05:34:20 CEST, "dxforth" <dxforth@gmail.com> wrote:

    On 3/05/2023 9:19 pm, Hans Bezemer wrote:

    Another consideration is how often an item is reused after an operation. >>>>> E.g. many times I need the target address after PLACE. It may be my way >>>>> of programming - and when I introduced PLACE I seriously considered it. >>>>> Eventually choosing compatibility over usability.

    Some forths had PACK. As my kernel used it three times vs. one for PLACE, >>>> I opted to provide both.

    What is PACK ?

    Same behaviour as PLACE but leaves the destination address.

    It is a mystery why those same people doesn't invent a !
    that leaves the destination address.

    SwiftForth has an optimization for TUCK ! Close enough?

    If the complaint be words should only do one thing then +! is in trouble.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Thu May 4 15:06:22 2023
    In article <u309nq$1qree$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote: >On 4/05/2023 7:49 pm, Ron AARON wrote:


    On 03/05/2023 20:19, Brian Fox wrote:
    On Wednesday, May 3, 2023 at 7:19:55 AM UTC-4, Hans Bezemer wrote:

    E.g. many times I need the target address after PLACE.

    For situations like that, with a non-optimizing compiler, I have DUP>R
    which is one instruction on my machine.
    I see that SwiftForth has DUP>R as well.

    Is DUP>R common in other systems?


    Don't know about common, but 8th has had dup>r for quite a while.

    I have RDROP ... mainly because it has the same run-time as UNNEST
    which I already had. The cost was but a header.

    Suddenly I realise that RDROP has right to exist.
    It is not an abbreviation of R> DROP . That is silly,
    copy it first to the data stack, then drop.
    So RDROP is an atomic action like >R and unlike DUP>R .

    Groetjes Albert

    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Ron AARON on Thu May 4 22:51:06 2023
    On 4/05/2023 7:49 pm, Ron AARON wrote:


    On 03/05/2023 20:19, Brian Fox wrote:
    On Wednesday, May 3, 2023 at 7:19:55 AM UTC-4, Hans Bezemer wrote:

    E.g. many times I need the target address after PLACE.

    For situations like that, with a non-optimizing compiler, I have DUP>R
    which is one instruction on my machine.
    I see that SwiftForth has DUP>R as well.

    Is DUP>R common in other systems?


    Don't know about common, but 8th has had dup>r for quite a while.

    I have RDROP ... mainly because it has the same run-time as UNNEST
    which I already had. The cost was but a header.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to albert on Fri May 5 00:18:27 2023
    On 4/05/2023 11:06 pm, albert wrote:
    In article <u309nq$1qree$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
    On 4/05/2023 7:49 pm, Ron AARON wrote:


    On 03/05/2023 20:19, Brian Fox wrote:
    On Wednesday, May 3, 2023 at 7:19:55 AM UTC-4, Hans Bezemer wrote:

    E.g. many times I need the target address after PLACE.

    For situations like that, with a non-optimizing compiler, I have DUP>R >>>> which is one instruction on my machine.
    I see that SwiftForth has DUP>R as well.

    Is DUP>R common in other systems?


    Don't know about common, but 8th has had dup>r for quite a while.

    I have RDROP ... mainly because it has the same run-time as UNNEST
    which I already had. The cost was but a header.

    Suddenly I realise that RDROP has right to exist.
    It is not an abbreviation of R> DROP . That is silly,
    copy it first to the data stack, then drop.
    So RDROP is an atomic action like >R and unlike DUP>R .

    DUP >R is not atomic because there are two discrete forth actions at work. DUP>R OTOH represents a new discrete forth function i.e. it performs a copy.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to albert@cherry. on Thu May 4 16:17:22 2023
    albert@cherry.(none) (albert) writes:
    Suddenly I realise that RDROP has right to exist.
    It is not an abbreviation of R> DROP . That is silly,
    copy it first to the data stack, then drop.
    So RDROP is an atomic action like >R and unlike DUP>R .

    What about R@? Do you think it has a right to exist, or should we
    rather introduce RDUP so that we can then do RDUP R>? DUP >R is the
    dual of RDUP R>, with the roles of the stacks swapped.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Anton Ertl on Thu May 4 11:09:57 2023
    On Thursday, May 4, 2023 at 12:25:23 PM UTC-4, Anton Ertl wrote:
    albert@cherry.(none) (albert) writes:
    Suddenly I realise that RDROP has right to exist.
    It is not an abbreviation of R> DROP . That is silly,
    copy it first to the data stack, then drop.
    So RDROP is an atomic action like >R and unlike DUP>R .
    What about R@? Do you think it has a right to exist, or should we
    rather introduce RDUP so that we can then do RDUP R>? DUP >R is the
    dual of RDUP R>, with the roles of the stacks swapped.

    I wonder what Socrates or Plato would think of Forth philosophy? It's definitely over my head. But, that's not saying much.

    --

    Rick C.

    --++ Get 1,000 miles of free Supercharging
    --++ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to none albert on Thu May 4 15:36:49 2023
    On Thursday, May 4, 2023 at 12:55:02 PM UTC+2, none albert wrote:
    In article <u2vuep$1pcrl$1...@dont-email.me>, dxforth <dxf...@gmail.com> wrote:
    On 4/05/2023 6:29 pm, Stephen Pelc wrote:
    On 4 May 2023 at 05:34:20 CEST, "dxforth" <dxf...@gmail.com> wrote:

    On 3/05/2023 9:19 pm, Hans Bezemer wrote:

    Another consideration is how often an item is reused after an operation.
    E.g. many times I need the target address after PLACE. It may be my way >>>> of programming - and when I introduced PLACE I seriously considered it. >>>> Eventually choosing compatibility over usability.

    Some forths had PACK. As my kernel used it three times vs. one for PLACE,
    I opted to provide both.

    What is PACK ?

    Same behaviour as PLACE but leaves the destination address.
    It is a mystery why those same people doesn't invent a !
    that leaves the destination address.
    Groetjes Albert

    --
    Don't praise the day before the evening. One swallow doesn't make spring. You must not say "hey" before you have crossed the bridge. Don't sell the hide of the bear until you shot it. Better one bird in the hand than ten in the air. First gain is a cat spinning. - the Wise from Antrim -
    Because those people rarely encounter a number that has to be appended to the previous number like +PLACE.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)