Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 23 |
Nodes: | 6 (0 / 6) |
Uptime: | 54:32:19 |
Calls: | 583 |
Files: | 1,139 |
D/L today: |
179 files (27,921K bytes) |
Messages: | 111,800 |
On 2025-07-03 17:11, albert@spenarnc.xs4all.nl wrote:
In article <1043831$3ggg9$1@dont-email.me>,
Ruvim-a <ruvim.pinka@gmail.com> wrote:
On 2025-07-02 15:37, albert@spenarnc.xs4all.nl wrote:
In article <1042s2o$3d58h$1@dont-email.me>,
Ruvim-a <ruvim.pinka@gmail.com> wrote:
On 2025-06-24 01:03, minforth wrote:
[...]
For me, the small syntax extension is a convenience when working
with longer definitions. A bit contrived (:= synonym for TO):
: SOME-APP { a f: b c | temp == n: flag z: freq }
\ inputs: integer a, floats b c
\ uninitialized: float temp
\ outputs: integer flag, complex freq
-a-a -a<: FUNC < ... calc function ... > ;>
BTW, why do you prefer the special syntax `<: ... ;>`
over an extension to the existing words `:` and `;`
-a-a-a : SOME-APP
-a-a-a-a-a-a [ : FUNC < ... calc function ... > ; ]
-a-a-a-a-a-a < ... >
-a-a-a ;
In this approach the word `:` knows that it's a nested definition and >>>>> behaves accordingly.
Or it has not even know it, if [ is smart enough to compile a jump to
after ].
This can be tricky because the following should work:
-a-a create foo [ 123 , ] [ 456 ,
-a-a : bar-a [ ' foo compile, 123 lit, ] ;
If this bothers you, rename it in [[ ]].
Once we enhance [ ] to do things prohibited by the standard,
(adding nested definitions) I can't be bothered with this too much.
The standard does not prohibit a system from supporting nested
definitions in whichever way that does not violate the standard behavior.
Yes, something like "private[ ... ]private" is a possible approach, and
its implementation seems simpler than adding the smarts to `:` and `;`
(and other defining words, if any).
The advantage of this approach over "<: ... ;>" is that you can define
not only colon-definitions, but also constants, variables, immediate
words, one-time macros, etc.
-a : foo ( F: r.coefficient -- r.result )
-a-a-a private[
-a-a-a-a-a variable cnt
-a-a-a-a-a 0e fvalue k
-a-a-a-a-a : [x] ... ; immediate
-a-a-a ]private
-a-a-a to k-a-a 0 cnt !
-a-a-a ...
-a ;
It's also possible to associated the word list of private words with the containing word xt for debugging purposes.