dxf
2024-04-29 05:14:58 UTC
Reply
Permalinknumeric string output. My guess it's because the Kitt Peak Forth document
from which the first attempts at a standard were drafted had no such words.
If anyone complained about the lack they were told 'Well, you can write your
own'. Which was true but unsatisfying. It made little sense to duplicate
what was essentially factors of the standard functions. When floating-point
was standardized, it was no longer so easy to DIY numeric strings.
So how have serious forth implementations handled the Standard's lack of
numeric string output functions? Many went ahead and provided (D.) (.)
(F.) etc. On the downside specs differed from one implementation to the
next. The other approach seen is redirection which involves taking the
existing standard functions D. . F. etc and sending the output to a
buffer instead of the console. Not every forth has the means of doing
this and it likely involves more code than the previous approach.
Why am I mentioning this? As the subject line suggests, I don't see how
Forth can be taken seriously without seriously considering numeric string
output. String output allows transformation - adding thousands separators
from (D.), transforming the exponent from (FE.) to SI units, etc. Even
the tiniest of forths can provide numeric string output at a cost cheaper
than adding it afterwards.