Deutsch   English   Français   Italiano  
<nnd$230b364e$0dc8505c@dcdf037aa1ea8bec>

View for Bookmarking (what is this?)
Look up another Usenet article

Newsgroups: comp.lang.forth
References: <f3d930ef062d020cd12825545af27eb8cccf9160@i2pn2.org> <2025Jan2.165111@mips.complang.tuwien.ac.at> <nnd$2bfceee3$0218258b@8de4578c5b52ef72> <2025Jan3.170018@mips.complang.tuwien.ac.at>
From: albert@spenarnc.xs4all.nl
Subject: Re: FP number syntax
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$230b364e$0dc8505c@dcdf037aa1ea8bec>
Organization: KPN B.V.
Date: Sat, 04 Jan 2025 17:09:43 +0100
Path: ...!weretis.net!feeder9.news.weretis.net!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feed.abavia.com!abe007.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 62
Injection-Date: Sat, 04 Jan 2025 17:09:43 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
Bytes: 2949

In article <2025Jan3.170018@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>albert@spenarnc.xs4all.nl writes:
>>One step further is to use 0x for hex values, and free $ for
>>environment strings.
>
>Forth systems can use 0x as hex prefix already, and in 2007 I checked
>several systems <http://www.forth200x.org/number-prefixes.html>: PFE,
>Gforth 0.6.9, Win32Forth (4.x and 6.x), and VFX Forth understood 0x10
>as well as 0X10; iForth, bigForth, SwiftForth, and lxf did not.
>
>Someone would need to make a proposal for making the $ prefix for hex
>numbers obsolescent as a first step towards destandardization.
>Meanwhile, Gforth has a recognizer for environment variables:
>
>${HOME} type
>
>prints "/home/anton".

In ciforth
    WANT $-PREFIX
adds `` # $ 0x '' to the minimal search order, because they define
numbers.

    { ONLY WORDS PREVIOUS } EXECUTE
     '   &   ^   0   1   2   3   4   5   6   7   8   9   A   B   C
    D   E   F   -   +   "   FORTH   $   0x   #    OK
                                    ^   ^    ^
The temporary executable thingy is needed, because after `ONLY , `WORDS
is not found. `PREVIOUS restores this.
A word "GET-ENV" is in order, e.g.
    "HOME" GET-ENV TYPE
    /home/albert OK
Now defining $ is easy, but it is preferable to get rid of the $ word first.
    '$ HIDDEN
    OK
    : $ NAME GET-ENV ; PREFIX
    OK
    $HOME TYPE
    /home/albert OK

Or your proposed syntax:
    : ${ &} PARSE GET-ENV ;  PREFIX

    ${HOME} TYPE
    /home/albert OK

These words land in the CURRENT wordlist not in `ONLY :
   WORDS
   ONLY   ENVIRONMENT   NOOP  ....
   .... ENV0   SHIFT-ARGS   (MENV)   GET-ENV   ${
   OK                                          ^
>
>- 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.