![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

Would your code be clearer using some other double number flag? The
most common one not counting dates and times in my humble experience is the
decimal point but that conflicts with floating point. We seem to use : a
lot, so that's probably not great. / has a collision with division but
that's not as terrible as the others. None of the punctuation is typo-proof
as all the characters used have other meanings.
My personal order of preference for a generic double number: (i.e. one that
is not a date or time)
0123456/ / has a collision with division so you need to be
careful of things like 2/. Using a leading 0 solves this problem.
0123456. . collision with floating point but very common and
widely understood
0123456-or+ + and - are used in words like 1+
0123456: : maybe having two dots will make sense to some
folks for a double number
0123456, , too often used in laying down a table
It's all pretty bad. Maybe date input should be a separate word and should
be taken out of NUMBER altogether. Then a single ASCII character with no
other use in Forth could be set aside as the double number punctuation.
ANSI will sell you a copy of the standard either at their store:
http://www.ansi.org/public/std_info.html
Or through Global Engineering Documents:
http://global.ihs.com/
There may still be an all-but-blessing copy of the standard on the
web somewhere.
The ANS Standard is not a good way to learn about Forth. Much better
are the "Forth Programmer's Handbook" and "Forth Application Techniques"
http://forth.com/Content/fat/fat.html
The SwiftX Reference Manual talks about , . + - / and : in numbers in
the Glossary entry on NUMBER, page 91 of the first edition.
> ----------
> From: David Graham[SMTP:dgraham_at_GrahamAutomationInc.com]
> Reply To: swiftx_at_forth.com
> Sent: Friday, June 01, 2001 10:02 AM
> To: swiftx_at_forth.com
> Subject: [swiftx] Re: Why is 4+ legal?
>
>
> Oh, I did not know +/- postscripts signify a double number. I had never
> seen that documented, nor did I understand that from Leon's answer. Now
> that I know about it, I will have frequent use for it. I wonder what else
> I
> am missing. What references document standard Forth? None of my Forth
> books
> mention this particular definition, including the SwiftX documents, as far
> as I can tell.
>
> Thanks,
> David Graham
>
> > -----Original Message-----
> > From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
> > Of Appert, Kevin
> > Sent: Friday, June 01, 2001 9:14 AM
> > To: 'swiftx_at_forth.com'
> > Subject: [swiftx] Re: Why is 4+ legal?
> >
> >
> >
> > To deal with the ED class of problem on one project we had a
> > rule that
> > numbers had to start with 0, like 0ED and NOTHING ELSE could
> > start with a 0.
> > The first few integers 00, 01, 02, etc. were defined and the 0, 1 and 2
> > definitions removed. This caused problems for one of my
> > colleagues who was
> > just learning C and carried the habit over where he learned what C
> thought
> > 0321 meant the hard way. This was a system which only had HEX and
> DECIMAL
> > and no $ flag for hex numbers.
> > You can't always tell the customer what he's doing wrong or
> > change the
> > standard to avoid all awkwardness. ED frequently starts the editor and
> I
> > guess $ED could be some sort of editor string. Perhaps all hex numbers
> > should start with $ and NOTHING ELSE should.
> > So 1+ is an increment and 4+ is a double number. 2+ is a coin toss
> > which caught me a while back when I didn't see it in some great code
> Leon
> > wrote. Maybe we should take + off the list of double number flags. Has
> > anyone ever used it or seen it used?
> >
> > > ----------
> > > From: David Graham[SMTP:dgraham_at_GrahamAutomationInc.com]
> > > Reply To: swiftx_at_forth.com
> > > Sent: Wednesday, May 30, 2001 12:25 PM
> > > To: swiftx_at_forth.com
> > > Subject: [swiftx] Re: Why is 4+ legal?
> > >
> > >
> > > I wanted to report a peculiar feature of SwiftX 3.0, HC12
> > > version. The compiler accepts n+ or n-, where n is any numeric
> > > digit, as a legal definition, and leaves n 0 in the stack. I
> > just caught
> > > by
> > > this when I mistyped 4 + as 4+.
> > >
> > > Regards,
> > > David Graham
> > > Graham Automation, Inc.
> > > PO Box 623
> > > McMinnville, OR 97128
> > > (503) 434-8636 Fax (503) 212-0181
> > > dgraham_at_GrahamAutomationInc.com
> > >
> > >
> > > > Hi David,
> > > >
> > > > That's an artifact of the standard Forth double number conversion.
> > > Always
> > > > be very careful with anything that might accidentally be
> > converted to a
> > > > number! One of our competitor's systems defines two words, ED
> > > > and $ED which
> > > > conflict with hex numbers of the same value. Drives me crazy.
> > > >
> > > > Leon
>
> ----------------------------------------------------------------------
> swiftx_at_forth.com The SwiftX programming discussion email list
> To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
> For help with listar commands, send subject "help" to listar_at_forth.com
> Archives are located at http://www.forth.com/swiftx -- check them out!
>
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
Received on Fri Jun 01 2001 - 11:28:04 PDT
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST