CfV: [DEFINED] and [UNDEFINED]
- From: anton@xxxxxxxxxxxxxxxxxxxxxxxxxx (Anton Ertl)
- Date: Tue, 04 Oct 2005 08:42:19 GMT
This is actually a poll about how widely the proposal is implemented
and how popular it is among the programmers. It is called a CfV
(call-for-votes) because the process is inspired by the Usenet Rdf/CfV
process.
You find the actual ballot further down (look for "VOTING PROCEDURE"),
after the proposal on which you vote.
[DEFINED] and [UNDEFINED]
Problem
The need for a standard word to find whether some Forth word has
already been defined and is available. The usefulness of such
words is indicated by how commonly they are available in one
form or another (see 'Experience' below). The greatest value is
probably for code expected to be run on different systems which
may differ in the words they provide.
Proposal
[DEFINED] ( "<spaces>string<space>" -- flag ) SEARCH EXT
Parse space-delimited string. Return true flag if string is the
name of a word found in the current search order; otherwise return
false flag. An Immediate word.
[UNDEFINED] ( "<spaces>string<space>" -- flag SEARCH EXT
Parse space-delimited string. Return false flag if string is the
name of a word found in the current search order; otherwise return
true flag. An Immediate word.
Remarks
The intent of the proposal is to establish a standard spelling for
a word widely used and commonly available, but with varying
orthography. The spelling proposed here is one of the common ones,
but there are a number of others.
It could be argued that adding to the Standard words so easily
defined (see below) just adds unnecessary bloat. The counter
argument is the convenience for someone writing code that may be
used on several different systems in knowing what name is used
for a common capability that may well be present.
Only one of the two is needed, since the other is obtained by
postpending 0=. My guess would be that [UNDEFINED] is used more
often, as in the Typical use below. But if a system has room to
provide one, why not both?
Reference implementation
: [DEFINED] BL WORD FIND NIP 0<> ; IMMEDIATE
: [UNDEFINED] BL WORD FIND NIP 0= ; IMMEDIATE
Typical use
[UNDEFINED] 4DUP [IF] : 4DUP 2OVER 2OVER ; [THEN]
Experience
Common as dirt. With one spelling or another, the capability
is provided in Wil Baden's Comus and toolkits and E. Rather's
Forth Programmer's Handbook. Versions are included in Gforth,
PFE, Bigforth and Win32Forth. I believe it is present in both
SwiftForth and VFX Forth for Windows, and Stephen Pelc says it
is part of the cross compiler draft standard. I'm sure there
are more.
The functionality is almost always equivalent to what is proposed
here, so it would seem that conforming to a standard spelling
should not be difficult for system developers.
Comments
(Summarized briefly. Details and attributions can be seen in the
archives of postings to groups.yahoo.com/group/forth200x and
comp.lang.forth. I find there was also a discussion of these and
related words in comp.lang.forth in October, 2000, in which many
of the same points were mentioned.)
There will always be a risk that on an unfamiliar system, a word
found might actually differ from the intended one, or a word sought
might be present but not found.
In the great majority of uses of [DEFINED] and [UNDEFINED] they are
followed with [IF]. Thus it might be convenient to have words like
[IFDEF] which incorporate the action of IF. The proposed words could
be factors for these.
Standardization would be convenient.
VOTING INSTRUCTIONS
Fill out the appropriate ballot(s) below and mail it/them to me
<anton@xxxxxxxxxxxxxxxxxxxxxxxxxx>. Your vote will be published
(including your name (without email address) and/or the name of your
system) on
<http://www.complang.tuwien.ac.at/forth/ansforth/defined.html>. You
can vote (or change your vote) at any time by mailing to me, and the
results will be published there.
Note that you can be both a system implementor and a programmer, so you can
submit both kinds of ballots.
Ballot for systems
If you maintain several systems, please mention the systems separately in the
ballot. Insert the system name or version between the brackets. Multiple hits
for the same system are possible (if they do not conflict).
[ ] conforms to ANS Forth.
[ ] already implements the proposal in full since release [ ].
[ ] implements the proposal in full in a development version.
[ ] will implement the proposal in full in release [ ].
[ ] will implement the proposal in full in some future release.
There are no plans to implement the proposal in full in [ ].
[ ] will never implement the proposal in full.
If you want to provide information on partial implementation, please do so
informally, and I will aggregate this information in some way.
Ballot for programmers
Just mark the statements that are correct for you (e.g., by putting an "x"
between the brackets). If some statements are true for some of your programs,
but not others, please mark the statements for the dominating class of
programs you write.
[ ] I have used (parts of) this proposal in my programs.
[ ] I would use (parts of) this proposal in my programs if the systems
I am interested in implemented it.
[ ] I would use (parts of) this proposal in my programs if this
proposal was in the Forth standard.
[ ] I would not use (parts of) this proposal in my programs.
If you feel that there is closely related functionality missing from the
proposal (especially if you have used that in your programs), make an informal
comment, and I will collect these, too. Note that the best time to voice such
issues is the RfD stage.
CREDITS
Proponent: Charles G Montgomery
Votetaker: M. Anton Ertl
--
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.complang.tuwien.ac.at/forth/ansforth/forth200x.html
EuroForth 2005: http://www.complang.tuwien.ac.at/anton/euroforth2005/
.
- Follow-Ups:
- Re: CfV: [DEFINED] and [UNDEFINED]
- From: Alex McDonald
- Re: CfV: [DEFINED] and [UNDEFINED]
- Prev by Date: Next-Gen Processor: Supercomputer on a Chip
- Next by Date: Re: Rational trigonometry
- Previous by thread: Next-Gen Processor: Supercomputer on a Chip
- Next by thread: Re: CfV: [DEFINED] and [UNDEFINED]
- Index(es):
Relevant Pages
|