• Re: Operator overloading?

    From Michael Raitza@21:1/5 to All on Thu Jul 25 10:02:22 2024
    I just googled it and it lives here, now: https://www.stephan-becher.de/strongforth/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to minforth on Thu Jul 25 12:08:58 2024
    minforth@gmx.net (minforth) writes:
    Thanks. But it seems this is only the old 16-bit DOS version.

    Looking at the Vierte Dimension 2/2024, which arrived this week, I
    find another article about the new, 32-bit strongForth, and also the
    link

    https://www.stephan-becher.de/strongforth3/

    I have been looking for the ANS-compatible layer file
    mentioned in the discussion.

    IMHO and without belittling strongforth's merits, I think
    that it went too far and proposed another Forth dialect.

    Whether it's too far or not is up to the recipient to decide. But
    yes, if you have a single and a double on the stack, say "1 2.", then
    in standard Forth you have to use ROT to switch them around, while in StrongForth you use SWAP.

    I am thinking on a much smaller scale i.e. unification of
    operators for xVALUEs and xLOCALs. ANS Forth already has
    overloaded TO but stops there.

    +TO is a common extension.

    - 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 2024: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jan Coombs@21:1/5 to minforth on Fri Jul 26 12:31:41 2024
    On Thu, 25 Jul 2024 07:30:58 +0000
    minforth@gmx.net (minforth) wrote:

    Or has anyone found another way to bundle/overload Forth operators?

    Would an (in-development) hardware solution be of any interest?

    Jan Coombs
    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Pelc@21:1/5 to All on Tue Jul 30 15:16:28 2024
    On 25 Jul 2024 at 08:30:58 BST, "minforth" <minforth> wrote:

    Forth has a lot of ‘redundant’ operators for e.g. arithmetic or
    stack operations, depending on the data type.

    There was once an interesting approach for a type-bound layer
    on top of standard Forth: https://comp.lang.forth.narkive.com/rexLEBd0/strongforth-implemented-in-ans-forth

    Unfortunately, the website for downloading strongforth.f
    is no longer available.

    Or has anyone found another way to bundle/overload Forth operators?

    The standard suggests/specifies that operators such as TO behave as if
    they parse. Ignore that for the moment and define

    variable operator

    : to 1 operator ! ; immediate

    A child of VALUE is probably an immediate word that inspects OPERATOR
    and compiles the fetch action if 0 or the store action if 1. This scheme can
    be extended to support a wide range of operators, such as +TO INCR DECR
    and so on. MPE has used this scheme for several decades with no tech
    support issues. If you really want to to be fussy and avoid the use of the
    "as if" rule for parsing, you can do something like (untested) the below
    for TO. But why bother?

    : to
    1 operator ! ' execute
    ; immediate

    Stephen

    --
    Stephen Pelc, stephen@vfxforth.com
    MicroProcessor Engineering, Ltd. - More Real, Less Time
    133 Hill Lane, Southampton SO15 5AF, England
    tel: +44 (0)78 0390 3612, +34 649 662 974
    http://www.mpeforth.com
    MPE website
    http://www.vfxforth.com/downloads/VfxCommunity/
    downloads

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Pelc@21:1/5 to All on Tue Jul 30 19:44:40 2024
    On 30 Jul 2024 at 19:55:55 BST, "minforth" <minforth> wrote:

    On Tue, 30 Jul 2024 15:16:28 +0000, Stephen Pelc wrote:
    The standard suggests/specifies that operators such as TO behave as if
    they parse. Ignore that for the moment and define

    variable operator

    : to 1 operator ! ; immediate

    A child of VALUE is probably an immediate word that inspects OPERATOR
    and compiles the fetch action if 0 or the store action if 1. This scheme
    can
    be extended to support a wide range of operators, such as +TO INCR DECR
    and so on. MPE has used this scheme for several decades with no tech
    support issues. If you really want to to be fussy and avoid the use of
    the
    "as if" rule for parsing, you can do something like (untested) the below
    for TO. But why bother?

    : to
    1 operator ! ' execute
    ; immediate

    Thank you. So instead of wasting time on parsing during compilation- or interpretation time, the runtime action of an xVALUE (even when
    compiled)
    involves to walk a type-specific operator chain (a large CASE construct
    in VFX). This makes them slower when compiled, but why not.

    The CASE statements are walked at compile time and so can produce
    fully optimised code. Just download a VFX Forth, read the source code,
    and disassemble the results.

    Stephen
    --
    Stephen Pelc, stephen@vfxforth.com
    MicroProcessor Engineering, Ltd. - More Real, Less Time
    133 Hill Lane, Southampton SO15 5AF, England
    tel: +44 (0)78 0390 3612, +34 649 662 974
    http://www.mpeforth.com
    MPE website
    http://www.vfxforth.com/downloads/VfxCommunity/
    downloads

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to stephen@vfxforth.com on Wed Jul 31 09:47:52 2024
    In article <v8b04c$137lg$1@dont-email.me>,
    Stephen Pelc <stephen@vfxforth.com> wrote:
    On 25 Jul 2024 at 08:30:58 BST, "minforth" <minforth> wrote:

    Forth has a lot of ‘redundant’ operators for e.g. arithmetic or
    stack operations, depending on the data type.

    There was once an interesting approach for a type-bound layer
    on top of standard Forth:
    https://comp.lang.forth.narkive.com/rexLEBd0/strongforth-implemented-in-ans-forth

    Unfortunately, the website for downloading strongforth.f
    is no longer available.

    Or has anyone found another way to bundle/overload Forth operators?

    The standard suggests/specifies that operators such as TO behave as if
    they parse. Ignore that for the moment and define

    There was a discussion about that before. The stipulaton is null and void.
    It was established that there was no way a compliant program could
    decide either way. It could be as well eliminated.

    <SNIP>
    Stephen

    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 purring. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gerry Jackson@21:1/5 to albert@spenarnc.xs4all.nl on Wed Jul 31 10:08:43 2024
    On 31/07/2024 08:47, albert@spenarnc.xs4all.nl wrote:
    In article <v8b04c$137lg$1@dont-email.me>,
    Stephen Pelc <stephen@vfxforth.com> wrote:
    On 25 Jul 2024 at 08:30:58 BST, "minforth" <minforth> wrote:

    Forth has a lot of ‘redundant’ operators for e.g. arithmetic or
    stack operations, depending on the data type.

    There was once an interesting approach for a type-bound layer
    on top of standard Forth:

    https://comp.lang.forth.narkive.com/rexLEBd0/strongforth-implemented-in-ans-forth

    Unfortunately, the website for downloading strongforth.f
    is no longer available.

    Or has anyone found another way to bundle/overload Forth operators?

    The standard suggests/specifies that operators such as TO behave as if
    they parse. Ignore that for the moment and define

    There was a discussion about that before. The stipulaton is null and void.
    It was established that there was no way a compliant program could
    decide either way. It could be as well eliminated.


    Here's a program that demonstrates a non-parsing TO:

    VFX Forth 64 for Windows x64
    © MicroProcessor Engineering Ltd, 1998-2023

    Version: 5.43 [build 4238]
    Build date: 9 November 2023

    Free dictionary = 6731782 bytes [6574kb]

    111 value x x . 111 ok
    222 to cr .( Does TO parse? ) x x 222 = [if] .( No it doesn't!) [then]
    Does TO parse? No it doesn't! ok

    Using a flag means that x could be on another line or even in another file.

    You could argue that it's not a standard program because it contains a deliberate ambiguous condition so a parsing TO would fail in some way
    but it does demonstrate non-compliant behaviour.

    Whether it matters is another matter.

    --
    Gerry

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Gerry Jackson on Wed Jul 31 16:14:53 2024
    Gerry Jackson <do-not-use@swldwa.uk> writes:
    On 31/07/2024 08:47, albert@spenarnc.xs4all.nl wrote:
    In article <v8b04c$137lg$1@dont-email.me>,
    Stephen Pelc <stephen@vfxforth.com> wrote:
    Here's a program that demonstrates a non-parsing TO:

    VFX Forth 64 for Windows x64
    © MicroProcessor Engineering Ltd, 1998-2023

    Version: 5.43 [build 4238]
    Build date: 9 November 2023

    Free dictionary = 6731782 bytes [6574kb]

    111 value x x . 111 ok
    222 to cr .( Does TO parse? ) x x 222 = [if] .( No it doesn't!) [then]
    Does TO parse? No it doesn't! ok

    Using a flag means that x could be on another line or even in another file.

    You could argue that it's not a standard program because it contains a >deliberate ambiguous condition

    Exactly, it's not a standard program, and no particular behaviour is
    specified in the standard for this program.

    so a parsing TO would fail in some way
    but it does demonstrate non-compliant behaviour.

    Given that it's not a standard program and no particular behaviour is prescribed, the behaviour of VFX is compliant for this program.

    There may be some way to construct a compliant program using FIND, SEARCH-WORDLIST, TRAVERSE-WORDLIST, or FIND-NAME, where VFX does not
    behave compliantly, though.

    - 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 2024: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gerry Jackson@21:1/5 to mhx on Wed Jul 31 19:36:10 2024
    On 31/07/2024 10:41, mhx wrote:
    On Wed, 31 Jul 2024 9:08:43 +0000, Gerry Jackson wrote:
    [..]
    111 value x x . 111  ok
    222 to cr .( Does TO parse? ) x x 222 = [if] .( No it doesn't!) [then]
    Does TO parse? No it doesn't! ok
    [..]

    As does iForth.

    Another silly thing that can be done in a flag setting Forth is

    0 value x
    2 to to to to x

    --
    Gerry

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