Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #135624
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth, comp.lang.postscript |
| Subject | Re: Postscript in 4tH |
| Date | 2026-09-09 10:03 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2026Sep9.120313@mips.complang.tuwien.ac.at> (permalink) |
| References | (2 earlier) <nnd$47db062e$781955bb@280ad1e4adf8c230> <875x0gib1k.fsf@debian> <117prfv$gq7e$3@dont-email.me> <2026Sep9.084205@mips.complang.tuwien.ac.at> <117r5b2$u52n$5@dont-email.me> |
Cross-posted to 2 groups.
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes:
>On Wed, 09 Sep 2026 06:42:05 GMT, Anton Ertl wrote:
>> You cannot get around this kind of stuff. Postscript has a subparser
>> for executable arrays ({ ... }) that behaves completely differently
>> from the regular parser that is also used to build literal arrays ([
>> ... ]).
[...]
> if len(ctx.currentprocs) != 0 :
> ctx.currentprocs[-1].append(the_obj)
> else :
> ctx.execute(the_obj, doproc = False)
> #end if
> #end interpret
>
>So the only difference in the parser between being inside a procedure
>definition (there is an entry in the ctx.currentprocs stack of
>in-progress procedure definitions) and outside it comes down to that
>last if-statement: if inside, append the just-parsed object (symbol,
>literal, nested procedure, whatever) to the current procedure
>definition; if outside, just execute it directly.
Sounds very much like compile state and interpret state.
>> The traditional indirect-threaded-code implememtations can be
>> considered homoiconic, and I wrote a word in the 1980s that made use
>> of this property to show a call graph of Forth words. Also,
>> decompilers made use of this property.
>
>That’s a limited form of read-only introspection. You couldn’t do
>transformations on the AST or such, could you?
Changing the compiled code was not common, but used. Even development
Gforth has:
|'replace-word' ( xt1 xt2 - ) gforth-1.0
| make xt2 do xt1, both need to be colon definitions
However, the more common approach is to change the source code and
load it again (typically in a new session, or after a FORGET or a
marker). And in Postscript and Lisp that's also the case.
And consequently, this feature of indirect-threaded code has been
abandoned by more advanced Forth systems. E.g., in Gforth, which
still has a threaded-code substrate, writing to some threaded-code
locations has no effect in the engines gforth and gforth-fast. If you
want to do such things, use the engine gforth-itc (for
indirect-threaded code).
>For a start, that would
>require dynamic memory allocation, which Forth doesn’t have.
Forth has what is usually understood under "dynamic memory
allocation", but it's not clear why that should be required for
writing to code.
- 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 2026 CFP: http://www.euroforth.org/ef26/cfp.html
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Postscript in 4tH Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-05 19:55 +0200
Re: Postscript in 4tH Paul Rubin <no.email@nospam.invalid> - 2026-09-05 15:54 -0700
Re: Postscript in 4tH albert@spenarnc.xs4all.nl - 2026-09-06 11:08 +0200
Re: Postscript in 4tH Paul Rubin <no.email@nospam.invalid> - 2026-09-07 09:24 -0700
Re: Postscript in 4tH albert@spenarnc.xs4all.nl - 2026-09-07 23:47 +0200
Re: Postscript in 4tH Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-08 02:09 -0300
Re: Postscript in 4tH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-08 20:34 +0000
Re: Postscript in 4tH Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-08 22:38 -0300
Re: Postscript in 4tH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-09 03:05 +0000
XML in Pythong (was: Re: Postscript in 4tH) Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-09 15:00 +0800
Re: Postscript in 4tH Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-10 01:06 -0300
Re: Postscript in 4tH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-10 07:38 +0000
Re: Postscript in 4tH Peter Flass <Peter@Iron-Spring.com> - 2026-09-10 07:39 -0700
Re: Postscript in 4tH antispam@fricas.org (Waldek Hebisch) - 2026-09-15 16:04 +0000
Re: Postscript in 4tH Paul Rubin <no.email@nospam.invalid> - 2026-09-15 09:24 -0700
Re: Postscript in 4tH Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-09 15:15 +0800
Re: Postscript in 4tH Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-10 01:11 -0300
Re: Postscript in 4tH anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-09-09 07:35 +0000
Re: Postscript in 4tH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-09 08:10 +0000
Re: Postscript in 4tH Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-10 17:58 +0200
Re: Postscript in 4tH Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-10 01:44 -0300
Re: Postscript in 4tH Paul Rubin <no.email@nospam.invalid> - 2026-09-09 03:01 -0700
Re: Postscript in 4tH albert@spenarnc.xs4all.nl - 2026-09-09 14:05 +0200
Re: Postscript in 4tH anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-09-09 06:42 +0000
Re: Postscript in 4tH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-09 08:28 +0000
Re: Postscript in 4tH anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-09-09 10:03 +0000
Re: Postscript in 4tH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-09 22:17 +0000
Re: Postscript in 4tH albert@spenarnc.xs4all.nl - 2026-09-09 14:42 +0200
Re: Postscript in 4tH antispam@fricas.org (Waldek Hebisch) - 2026-09-09 19:17 +0000
Re: Postscript in 4tH albert@spenarnc.xs4all.nl - 2026-09-10 12:22 +0200
Re: Postscript in 4tH Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-09 21:54 +0000
Re: Postscript in 4tH Paul Rubin <no.email@nospam.invalid> - 2026-09-09 22:14 -0700
Re: Postscript in 4tH albert@spenarnc.xs4all.nl - 2026-09-10 12:30 +0200
Re: Postscript in 4tH albert@spenarnc.xs4all.nl - 2026-09-09 14:36 +0200
Re: Postscript in 4tH Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-06 14:27 +0200
Re: Postscript in 4tH Hans Bezemer <the.beez.speaks@gmail.com> - 2026-09-08 17:18 +0200
csiph-web