• Use of { and } was Re: Back & Forth - Co-routines

    From albert@spenarnc.xs4all.nl@21:1/5 to Anton Ertl on Sat Feb 1 13:14:50 2025
    In article <2025Feb1.085049@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    dxf <dxforth@gmail.com> writes:
    If I use locals I'm more likely to
    use the ANS notation. I notice Forth Inc does too - perhaps why they were so >>adverse to conceding to { } .

    The reason why Forth, Inc. argued against { } is that they support an >existing code base that uses { } for comments; they use { } comments >extensively in SwiftForth, and their customers use it, too. They
    voted for {: :}, so they obviously don't have a problem with the
    ordering of locals in {: :} (which is the same as for { }).

    Not knowing Swiftforth I have introduced { } for anonymous code snippets
    for ciforth. These anonymous snippets work the same in interpret and compile mode,

    { DROP } EXECUTE
    : xxx { DROP } EXECUTE ;

    They must look familiar to those who use "normal" languages ;-) .
    (swiftforth has a point too, { } is used for comment in Pascal.)

    The dispatch table for equality in my lisp (version based on Mark Probst)
    looks like:
    "
    \ For respective: nil pair number builtin symbol special compound
    0
    { = lisp-flag }
    { = lisp-flag }
    { number-num swap number-num = lisp-flag }
    { = lisp-flag }
    { >R symbol-name R> symbol-name $= lisp-flag }
    { = lisp-flag }
    { = lisp-flag }
    (create-table) TO eq?-dispatch
    "

    Now introduce :NONAME and be surprised how clunky this becomes.

    The implementation didn't cost me an arm and a leg:
    "
    ' TASK @ CONSTANT DOCOL
    \ Denotation for lambda, ends with `}
    : { 'SKIP , (FORWARD HERE DOCOL , HERE CELL+ ,
    STATE @ 1 STATE ! ; IMMEDIATE
    : } '(;) , STATE ! >R FORWARD) R> POSTPONE LITERAL
    ; IMMEDIATE
    "

    Considering the elementary character of this, it is written out
    for speed.

    If you have available the 4 brackets of the apocalypse it is
    more straightforward:

    : { (( (s ({) ; IMMEDIATE
    : } >R (}) s) )) R> 'LITERAL EXECUTE ; IMMEDIATE
    [ LITERAL is the only state smart word in ciforth.
    In interpret mode it does nothing.
    In compile mode it compiles a literal. ]

    As a reminder the 4 brackets:
    \ Compact version of :NONAME .. ; not linked in.
    ({) .. (})
    \ Nest dictionary space.
    (( .. ))
    \ (s s) save and restore STATE.
    (s .. s)
    \ Nest definitions (not used in the above)
    ([) .. (])

    In a complex Forth these words may be difficult to implement.


    - anton

    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 Anton Ertl@21:1/5 to dxf on Sun Feb 2 07:39:26 2025
    dxf <dxforth@gmail.com> writes:
    On 1/02/2025 11:14 pm, albert@spenarnc.xs4all.nl wrote:
    { } is used for comment in Pascal.

    That's interesting. When did that come in, and why, given the issues?

    Good question. My memory is only of (* *), but indeed Section 6.1.8
    of https://www.standardpascal.org/iso7185.pdf makes it clear that (*
    and { can be used interchangeably, as well as *) and }.

    - 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 2023 proceedings: http://www.euroforth.org/ef23/papers/
    EuroForth 2024 proceedings: http://www.euroforth.org/ef24/papers/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to Anton Ertl on Sun Feb 2 12:05:04 2025
    In article <2025Feb2.083926@mips.complang.tuwien.ac.at>,
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    dxf <dxforth@gmail.com> writes:
    On 1/02/2025 11:14 pm, albert@spenarnc.xs4all.nl wrote:
    { } is used for comment in Pascal.

    That's interesting. When did that come in, and why, given the issues?

    Good question. My memory is only of (* *), but indeed Section 6.1.8
    of https://www.standardpascal.org/iso7185.pdf makes it clear that (*
    and { can be used interchangeably, as well as *) and }.

    The first publication of Pascal was IIRC

    1975
    Pascal , user manual and report.
    Jensen/Wirth
    ISBN 0-387-90144-2

    Uses { } in all examples, and it is referenced in chapter 1, briefly.
    At the time not all keyboard had curly brackets. The alternative
    (* and *) is mentionned in chapter 1 too.


    - anton

    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 Anton Ertl@21:1/5 to albert@spenarnc.xs4all.nl on Sun Feb 2 14:32:27 2025
    albert@spenarnc.xs4all.nl writes:
    The first publication of Pascal was IIRC

    1975
    Pascal , user manual and report.
    Jensen/Wirth
    ISBN 0-387-90144-2

    Uses { } in all examples, and it is referenced in chapter 1, briefly.

    "Programming in Modula-2" Second Edition contains the "Report on The Programming Language Modula-2", and only (* and *) are defined there
    as delimiting comments. It says that comments are nestable.

    I also have a book on Pascal: "Pascal Handbuch" by E. Floegel. In
    Figure 3.31 on page 15 it shows (* and *), but not { and } as
    "Verwendete Zeichen in Pascal" (used characters in Pascal, although
    the intention is probably to show the symbolic lexemes).

    - 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 2023 proceedings: http://www.euroforth.org/ef23/papers/
    EuroForth 2024 proceedings: http://www.euroforth.org/ef24/papers/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bernd Linsel@21:1/5 to All on Sun Feb 2 16:57:21 2025
    T24gMDIuMDIuMjUgMTU6MzIsIEFudG9uIEVydGwgd3JvdGU6DQo+IGFsYmVydEBzcGVuYXJu Yy54czRhbGwubmwgd3JpdGVzOg0KPj4gVGhlIGZpcnN0IHB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gZm9yIGluZGljZXMgKGluc3RlYWQgb2YgWy4uLl0pLCANCmJl Y2F1c2Ugb3RoZXJ3aXNlIGNvbW1lbnRzIHdvdWxkIGhhdmUgYXBwZWFyZWQgYXMgw6QgLi4u IMO8LCBhbmQgaW5kaWNlcyANCmFzIMOEIC4uLiDDnC4NCg0KLS0gDQpCZXJuZCBMaW5zZWwN
    Cg==

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Waldek Hebisch@21:1/5 to Anton Ertl on Thu Feb 6 01:38:57 2025
    Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
    dxf <dxforth@gmail.com> writes:
    On 1/02/2025 11:14 pm, albert@spenarnc.xs4all.nl wrote:
    { } is used for comment in Pascal.

    That's interesting. When did that come in, and why, given the issues?

    Good question. My memory is only of (* *), but indeed Section 6.1.8
    of https://www.standardpascal.org/iso7185.pdf makes it clear that (*
    and { can be used interchangeably, as well as *) and }.

    '{' and '}' are original Pascal comments. I do not think they have
    any issue beyond normal ones, that is inability to put '}' as
    part of a comment. Since comments were intended to be text and
    '}' is not used as normal part of text presumably inability to
    put '}' inside a comment was deemed as non-issue.

    Pascal was bases on ASCII, but IBM mainframes used EBCDIC which
    missed several useful ASCII characters, notably '{', '}',
    '[', '[', so Pascal implementations on IBM mainframes used
    alternate sequences. The alternative seqences were standarized
    together with originals.

    More generally, Wirth had rather rigid view how "good" program
    should look like and this view was enforced by Pascal compilers.
    Practical Pascals and later Extended Pascal were much more
    flexible.

    --
    Waldek Hebisch

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