Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #27864
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: late binding |
| Date | 2014-01-13 14:41 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2014Jan13.154145@mips.complang.tuwien.ac.at> (permalink) |
| References | <7xr48eg7q1.fsf@ruckus.brouhaha.com> |
Paul Rubin <no.email@nospam.invalid> writes:
> You can
>redefine BAR:
>
> : FOO 1 BAR + ;
> : BAR 4 ;
>
> FOO 5 ok \ FOO prints 5
>
> : BAR 8 ; \ overwrite the same CFA again
> FOO 9 ok \ FOO now prints 9
>
>It costs an extra memory access depending on implementation, not too
>bad. The advantage is you can now redefine words during debugging,
>without having to reload the whole program which usually means
>clobbering the program state. When you redefine a word, all callers
>will now call the new word. Also you no longer have to define each word
>before it's used.
>
>I know you can do a version of this with DEFER, but this idea is more
>pervasive.
>
>Is this just terrible, from a Forth cultural (or other) standpoint?
At least it's not as terrible as EVALUATE-based macros, because this
kind of redefinition binds at the compile time of the new BAR, whereas
EVALUATE-based macros are a gross cross between early and late
binding; and yet, EVALUATE-based macros have their fans, so your
simulation of late binding will probably be acceptable to many.
Anyway, the standard Forth way of name binding works out very well for
dealing with multiple independent definitions of the same name (see
<http://www.complang.tuwien.ac.at/forth/language-features.html>; I
should expand the other sections:-).
- 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: http://www.forth200x.org/forth200x.html
EuroForth 2013: http://www.euroforth.org/ef13/
Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread
late binding Paul Rubin <no.email@nospam.invalid> - 2014-01-11 01:59 -0800
Re: late binding Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-01-11 04:16 -0600
Re: late binding Paul Rubin <no.email@nospam.invalid> - 2014-01-11 03:06 -0800
Re: late binding anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-13 15:31 +0000
Re: late binding albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-01-11 14:05 +0000
Re: late binding Ron Aaron <rambamist@gmail.com> - 2014-01-11 17:58 +0200
Re: late binding "Elizabeth D. Rather" <erather@forth.com> - 2014-01-11 08:55 -1000
Re: late binding Paul Rubin <no.email@nospam.invalid> - 2014-01-11 11:23 -0800
Re: late binding "Elizabeth D. Rather" <erather@forth.com> - 2014-01-11 10:37 -1000
Re: late binding Michael L Gassanenko <m_l_g3@yahoo.com> - 2014-01-13 00:01 -0800
Re: late binding m.a.m.hendrix@tue.nl - 2014-01-13 04:18 -0800
Re: late binding Mark Wills <markrobertwills@yahoo.co.uk> - 2014-01-13 00:51 -0800
Re: late binding Matthias Koch <matthias.koch@hot.uni-hannover.de> - 2014-01-13 14:40 +0100
Re: late binding anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-13 14:41 +0000
csiph-web