Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #52440
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Word lists and word sets |
| Date | 2016-11-04 17:09 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2016Nov4.180911@mips.complang.tuwien.ac.at> (permalink) |
| References | <5cae7f30-610d-48d2-82b6-16cc208326ac@googlegroups.com> <5d2b244f-470c-443c-a560-dac171874d26@googlegroups.com> |
minforth@arcor.de writes:
>Thanks for your responses.
>
>So I can forget ENVIRONMENT? (and while I am at it forget FORGET as well) ;-)
As a programmer, sure, if you don't need it, ignore it. Of course,
the problem is that if you need it, some systems have pretty useless
implementations. If you have that problem, make it known to the
system providers.
As a system implementor, ENIRONMENT? is a core word, so if you want to
have a standard system, you have to implement it. Whether your
implementation is then useless or useful is a
quality-of-implementation issue.
FORGET is optional, somewhat popular (there was a "save FORGET"
movement that succeeded for Forth-2012 despite FORGET being
obsolescent since Forth-94), but Gforth does not have it and we have
heard few calls for it. So it's up to you.
>And it does not make much sense to select some wordsets for a system implementation without implementing exceptions (which can be a can of worms when one has to close files or i/o channels after exceptions).
I think it's a good idea to implement the exception wordset, and it
does not make much sense not to implement it. Nevertheless, if you
really dislike it, you can leave it away, and the rest of the wordsets
will just work fine. Of course, most programmers using the FILE and
MEMORY wordsets also use THROW, so if you want your system to run
programs by other programmers (and why else would you want to write a
standard system), that's a good practical reason to have EXCEPTION
with both.
As for closing files after exceptional conditions, the exception
wordset allows programmers to actually handle such cases properly,
e.g.:
: open-execute ( c-addr u fam xt -- )
\ xt has stack-effect ( fid -- )
>r open-file throw r> over >r catch r> close-file throw throw ;
There is a small window of vulnerability between OPEN-FILE and CATCH,
and between CATCH and CLOSE-FILE, but in most cases it's much better
than the classical Forth approach of just ABORTing and leaving it to
the user to clean up.
>So IMO it would have been good to have a more elborated namespace standard,
Not sure what name spaces have to do with any of that.
- 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 2016: http://www.euroforth.org/ef16/
Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread
Word lists and word sets minforth@arcor.de - 2016-11-03 09:37 -0700
Re: Word lists and word sets Mark Wills <markwills1970@gmail.com> - 2016-11-03 14:25 -0700
Re: Word lists and word sets anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-03 22:40 +0000
Re: Word lists and word sets anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-03 21:57 +0000
Re: Word lists and word sets minforth@arcor.de - 2016-11-04 06:59 -0700
Re: Word lists and word sets anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-04 17:09 +0000
csiph-web