• Re: In C world they invented FORGET and DP lately

    From minforth@21:1/5 to All on Thu May 8 01:59:25 2025
    That's artificially pulled out of thin air. I've never had
    any problems with realloc.

    You could also say that Forth has forgotten garbage collection.

    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kerr-Mudd, John@21:1/5 to dxf on Thu May 8 11:08:11 2025
    On Thu, 8 May 2025 19:30:57 +1000
    dxf <dxforth@gmail.com> wrote:

    On 8/05/2025 6:39 pm, LIT wrote:
    Aimless fiddlers should just switch to Forth.

    In next 20 years they'll figure out how to FORGET
    a function.

    I can't remember the last time I forgot something.

    :-)


    --
    Bah, and indeed Humbug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to the.beez.speaks@gmail.com on Thu May 8 13:11:52 2025
    In article <nnd$3f3c0437$711db4e3@cd8cc85eb802039d>,
    Hans Bezemer <the.beez.speaks@gmail.com> wrote:
    On 08-05-2025 11:30, dxf wrote:
    On 8/05/2025 6:39 pm, LIT wrote:
    Aimless fiddlers should just switch to Forth.

    In next 20 years they'll figure out how to FORGET
    a function.

    I can't remember the last time I forgot something.
    Actually - I use it daily. Note that 4tH has no word sets and no
    namespaces. Coming from C - I never felt I needed them. What I *did*
    have was "static" - which allowed me to hide those functions which
    weren't important for the API of that module.

    So I added HIDE to 4tH, to clean up modules for that very purpose.
    Usually, all non-public words are named like (NAME) - according to the
    rules set in "Thinking Forth". Which already helps to avoid any
    collisions, since even *if* they were previously used, they would be
    hidden by now.

    So its' not uncommon to see some - or even rather large - lists of HIDEs
    at the end of a module. Note I don't have to do them by hand, this one
    does it for me: >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/makehide.4th

    Other Forths had HIDE, so I borrowed it. There is no UNHIDE or
    equivalent because 4tH can't. The thing is thrown out of the symbol
    table completely on HIDE.

    Also, the size of the symbol table is determined by (amongst others)
    HIDE. Defining words expand the size of the symbol table, HIDE reduces
    it. That's why you can't make HIDE act conditionally by [IF] and [THEN]
    - since at that stage, the system is unable to evaluate such expressions.

    I guess that you reorder the links fields.

    I use a bit flag, so that it can be undone.
    'DROP DUP HIDDEN \ easier: `` HIDE DROP '' , but I need the address.
    \ no use of `DROP here.
    ( dea - ) HIDDEN \ Pops up again.

    1 2 DROP .S
    1

    I like NAMESPACE (aka pushing vocabularies).
    My lisp namespace totally hides there is a Forth underneath.


    Hans Bezemer


    Groetjes Albert
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ron AARON@21:1/5 to Hans Bezemer on Thu May 8 13:55:46 2025
    On 08/05/2025 13:43, Hans Bezemer wrote:
    On 08-05-2025 11:30, dxf wrote:
    On 8/05/2025 6:39 pm, LIT wrote:
    Aimless fiddlers should just switch to Forth.

    In next 20 years they'll figure out how to FORGET
    a function.

    I can't remember the last time I forgot something.
    Actually - I use it daily. Note that 4tH has no word sets and no
    namespaces. Coming from C - I never felt I needed them. What I *did*
    have was "static" - which allowed me to hide those functions which
    weren't important for the API of that module.

    So I added HIDE to 4tH, to clean up modules for that very purpose.
    Usually, all non-public words are named like (NAME) - according to the
    rules set in "Thinking Forth". Which already helps to avoid any
    collisions, since even *if* they were previously used, they would be
    hidden by now.

    So its' not uncommon to see some - or even rather large - lists of HIDEs
    at the end of a module. Note I don't have to do them by hand, this one
    does it for me: https://sourceforge.net/p/forth-4th/code/HEAD/tree/ trunk/4th.src/makehide.4th

    Other Forths had HIDE, so I borrowed it. There is no UNHIDE or
    equivalent because 4tH can't. The thing is thrown out of the symbol
    table completely on HIDE.

    Also, the size of the symbol table is determined by (amongst others)
    HIDE. Defining words expand the size of the symbol table, HIDE reduces
    it. That's why you can't make HIDE act conditionally by [IF] and [THEN]
    - since at that stage, the system is unable to evaluate such expressions.

    In fact, that's where I use 'forget' in 8th. When I "need" a library
    file, it can have "private" words which go in a special namespace. At
    the end of processing the library, I forget that namespace and so the
    words are truly invisible outside of the library scope.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mhx@21:1/5 to albert@spenarnc.xs4all.nl on Fri May 9 06:43:30 2025
    On Thu, 8 May 2025 11:11:52 +0000, albert@spenarnc.xs4all.nl wrote:
    [..]
    My lisp namespace totally hides there is a Forth underneath.

    Why? I think it is useful to add lisp functions to a Forth
    program if that is appropriate to the task at hand. Or
    even more useful if one could add Forth words to a lisp
    interpreter that is written in Forth (like I did for the tinykiss
    compiler https://iforth.nl/crenshaw/mchapter17/tinykiss.frt ).

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to mhx on Fri May 9 14:29:26 2025
    In article <f32b8e3a546cb4845eb0feb00611fff3@www.novabbs.com>,
    mhx <mhx@iae.nl> wrote:
    On Thu, 8 May 2025 11:11:52 +0000, albert@spenarnc.xs4all.nl wrote:
    [..]
    My lisp namespace totally hides there is a Forth underneath.

    Why? I think it is useful to add lisp functions to a Forth
    program if that is appropriate to the task at hand. Or
    even more useful if one could add Forth words to a lisp
    interpreter that is written in Forth (like I did for the tinykiss
    compiler https://iforth.nl/crenshaw/mchapter17/tinykiss.frt ).

    I can't think of any lisp functions that enhance Forth.
    I'm more ambitious. I think Forth is a good substrate to implement lisp.
    My ideal:
    OTOH lisp enthusiast discovering that the most capable lisp is
    implemented in ... Forth.

    Compare my lisp implementation in git to the original of Mark Probst.
    His implementation doesn't look like lisp to a lisper, because he must
    start up gforth first. The largest part of his effort is to rewrite
    a special read-evaluate-loop in Forth, ignoring that Forth itself is
    an interpreter, and only minor modifications are sufficient to understand
    lisp.

    gforth is implemented in c. Imagine that you have to start gforth,
    initiating from a c-compiler/interpreter.

    -marcel

    Groetjes Albert
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

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