Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #135006
| Date | 2026-04-28 14:34 +0200 |
|---|---|
| Subject | Re: locals |
| Newsgroups | comp.lang.forth |
| References | (8 earlier) <87o6j74l1z.fsf@nightsong.com> <2026Apr25.084323@mips.complang.tuwien.ac.at> <87340i46vi.fsf@nightsong.com> <2026Apr26.115059@mips.complang.tuwien.ac.at> <69eeb7e3$1@news.ausics.net> |
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
| Message-ID | <nnd$4f4e2a9e$374ec9cd@106d3930ad445e18> (permalink) |
| Organization | www.abavia.com |
On 27-04-2026 03:12, dxf wrote: > On 26/04/2026 7:50 pm, Anton Ertl wrote: >> Paul Rubin <no.email@nospam.invalid> writes: >> ... >>> I've >>> imagined some alternate versions of COLON, e.g. >>> : foo ( ... ) ; \ regular colon, no locals >>> 1: foo ( ... ) ; \ one local called A >>> 2: foo (... ) ; \ two locals, A and B >>> ... >>> 4: foo (... ) ; \ four locals: A, B, C, D. >> As a matter of fact, this thingy creates locals: : ;: >r ; : local r> swap dup >r @ >r ;: r> r> ! ; >> If you cannot chose the names, locals lose a lot of their benefits in >> making the code more understandable (OTOH, mathematicians have made to >> with similar naming schemes for a long time). You might then just as >> well work with >R >R >R >R and R@, R'@, 2 RPICK and 3 RPICK. > > That Julian Noble (among others) felt the need for FTRAN INTRAN etc informs > what scientists and academics really want - and it's a long way from the > 'stack based' locals offered by most forth systems. The latter represent > a concession to forth before a user has even begun to consider identifiers. > To an outsider, forth locals do nothing to ameliorate what they see as > fundamentally broken about the language. ISTM if a forther has conceded to > use stack-based locals, he can certainly make choices about what form > identifiers take. You can do that with the 4tH preprocessor. This uses the above code: : ;: >r ; : local r> swap dup >r @ >r ;: r> r> ! ; variable x \ var x variable y \ var y : multiply ( n1 n2 -- n1*n2) x local \ turn into local y local \ turn into local let y=; let x=; \ take values from the stack let x = (x * y); \ multiply them let x,|. cr|; \ get x, perform ". cr" ; 23 x ! \ proof it is a local 7 6 multiply \ multiply 6 by y x ? cr \ now let's check that And this is the output: $ pp4th -x testme.4pp 42 23 Note that the output of the preprocessor works fine on a vanilla Forth: Gforth 0.7.9_20250321 Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type `authors' Copyright © 2025 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license' Type `help' for basic help : ;: >r ; : local r> swap dup >r @ >r ;: r> r> ! ; ok ok variable x ok variable y ok ok : multiply compiling x local compiling y local compiling compiling y ! x ! compiling compiling x @ y @ * x ! compiling x @ . cr compiling ; ok ok 23 x ! ok 7 6 multiply 42 ok x ? cr 23 ok Hans Bezemer
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-05 23:25 +0100
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-05 23:30 +0100
Re: Coroutines in Forth Paul Rubin <no.email@nospam.invalid> - 2026-04-05 17:16 -0700
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-06 19:58 +0100
Re: Coroutines in Forth Paul Rubin <no.email@nospam.invalid> - 2026-04-22 11:13 -0700
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-22 22:05 +0200
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-07 13:23 +0200
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-06 13:51 +0200
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-06 22:20 +0100
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-07 13:35 +0200
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-07 20:55 +0100
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-08 12:34 +0200
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-08 12:32 +0100
Re: Coroutines in Forth Stephen Pelc <stephen@vfxforth.com> - 2026-04-09 10:12 +0000
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-10 19:01 +0200
Re: Coroutines in Forth dxf <dxforth@gmail.com> - 2026-04-11 11:54 +1000
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-05-01 13:07 +0200
Re: Coroutines in Forth peter <peter.noreply@tin.it> - 2026-04-11 09:49 +0200
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-11 22:03 +0200
Re: Coroutines in Forth dxf <dxforth@gmail.com> - 2026-04-12 12:49 +1000
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-12 12:13 +0200
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-12 17:39 +0200
Re: Coroutines in Forth dxf <dxforth@gmail.com> - 2026-04-13 10:54 +1000
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-13 19:24 +0200
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-12 13:48 +0200
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-13 12:13 +0200
Re: Coroutines in Forth Paul Rubin <no.email@nospam.invalid> - 2026-04-22 11:18 -0700
Re: Coroutines in Forth dxf <dxforth@gmail.com> - 2026-04-23 11:13 +1000
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-23 12:37 +0200
Re: Coroutines in Forth Paul Rubin <no.email@nospam.invalid> - 2026-04-24 10:36 -0700
Re: Coroutines in Forth dxf <dxforth@gmail.com> - 2026-04-25 12:12 +1000
Re: Coroutines in Forth Paul Rubin <no.email@nospam.invalid> - 2026-04-24 23:31 -0700
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-25 10:45 +0200
Re: Coroutines in Forth dxf <dxforth@gmail.com> - 2026-04-25 22:06 +1000
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-25 15:11 +0200
Re: Coroutines in Forth dxf <dxforth@gmail.com> - 2026-04-26 13:33 +1000
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-26 16:28 +0200
Re: Coroutines in Forth Paul Rubin <no.email@nospam.invalid> - 2026-04-25 21:46 -0700
FP stack depth limitations (was: Coroutines in Forth) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-26 05:55 +0000
Re: FP stack depth limitations Paul Rubin <no.email@nospam.invalid> - 2026-04-26 00:28 -0700
Re: FP stack depth limitations dxf <dxforth@gmail.com> - 2026-04-26 19:55 +1000
Re: FP stack depth limitations (was: Coroutines in Forth) peter <peter.noreply@tin.it> - 2026-04-26 09:57 +0200
Re: FP stack depth limitations (was: Coroutines in Forth) albert@spenarnc.xs4all.nl - 2026-04-26 14:34 +0200
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-25 15:01 +0200
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-05-01 13:13 +0200
Forth, C, hardware, and programming virtues (was: Coroutines in Forth) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-25 05:26 +0000
Re: Forth, C, hardware, and programming virtues Paul Rubin <no.email@nospam.invalid> - 2026-04-24 23:55 -0700
Re: Forth, C, hardware, and programming virtues anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-25 08:21 +0000
Re: Forth, C, hardware, and programming virtues albert@spenarnc.xs4all.nl - 2026-04-25 11:27 +0200
Re: Forth, C, hardware, and programming virtues Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-25 15:43 +0200
Re: Forth, C, hardware, and programming virtues anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-25 17:21 +0000
Re: Forth, C, hardware, and programming virtues dxf <dxforth@gmail.com> - 2026-04-26 15:21 +1000
Re: Forth, C, hardware, and programming virtues Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-26 15:08 +0200
Re: Forth, C, hardware, and programming virtues albert@spenarnc.xs4all.nl - 2026-04-26 00:34 +0200
Re: Forth, C, hardware, and programming virtues Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-26 15:10 +0200
locals (was: Coroutines in Forth) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-25 04:47 +0000
Re: locals Paul Rubin <no.email@nospam.invalid> - 2026-04-24 23:21 -0700
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-25 06:43 +0000
Re: locals albert@spenarnc.xs4all.nl - 2026-04-25 11:43 +0200
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-25 10:22 +0000
Re: locals peter <peter.noreply@tin.it> - 2026-04-25 16:07 +0200
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-25 17:38 +0200
Re: locals albert@spenarnc.xs4all.nl - 2026-04-26 01:13 +0200
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-26 14:03 +0000
Re: locals peter <peter.noreply@tin.it> - 2026-04-27 09:31 +0200
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-27 07:53 +0000
Re: locals peter <peter.noreply@tin.it> - 2026-04-27 11:52 +0200
Re: locals albert@spenarnc.xs4all.nl - 2026-04-26 00:51 +0200
Re: locals Paul Rubin <no.email@nospam.invalid> - 2026-04-25 22:40 -0700
Re: locals albert@spenarnc.xs4all.nl - 2026-04-26 14:55 +0200
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-26 09:50 +0000
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-26 16:22 +0200
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-26 17:04 +0000
Re: locals dxf <dxforth@gmail.com> - 2026-04-27 11:51 +1000
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-28 08:21 +0200
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-28 08:22 +0200
Re: locals dxf <dxforth@gmail.com> - 2026-04-27 11:12 +1000
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-28 14:34 +0200
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-28 14:34 +0200
Re: locals Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-29 12:44 +0100
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-29 14:37 +0200
Re: locals Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-29 14:44 +0200
Re: locals Paul Rubin <no.email@nospam.invalid> - 2026-05-01 23:50 -0700
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-02 10:34 +0000
Re: locals Paul Rubin <no.email@nospam.invalid> - 2026-05-01 23:54 -0700
Re: locals dxf <dxforth@gmail.com> - 2026-05-02 17:36 +1000
Re: locals Paul Rubin <no.email@nospam.invalid> - 2026-05-02 01:11 -0700
Re: locals anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-02 15:58 +0000
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-07 09:28 -0500
Re: Coroutines in Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-04-07 16:12 +0000
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-07 18:06 -0500
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-08 11:43 +0100
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-08 13:16 +0200
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-08 11:47 -0500
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-08 21:48 +0100
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-09 07:06 -0500
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-09 16:41 +0200
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-09 13:34 -0500
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-10 01:23 +0200
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-09 21:34 -0500
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-09 13:01 +0200
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-09 07:01 -0500
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-09 16:10 +0200
Re: Coroutines in Forth Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-04-09 13:29 -0500
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-08 21:26 +0100
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-08 14:22 +0200
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-28 15:31 +0200
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-29 10:49 +0200
Re: Coroutines in Forth Hans Bezemer <the.beez.speaks@gmail.com> - 2026-04-29 15:22 +0200
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-08 11:33 +0100
Re: Coroutines in Forth albert@spenarnc.xs4all.nl - 2026-04-08 13:07 +0200
Re: Coroutines in Forth Gerry Jackson <do-not-use@swldwa.uk> - 2026-04-08 22:05 +0100
csiph-web