The Beez <
the.bee...@gmail.com> writes:
> 1 I don't see splitting off the internals of a program very often --
> but actually, it works great in a well configured 4tH system! :-)
For YUKO, dividing the conversion words and the calculator environment
into separate files seemed like the obvious choice since the conversion
library part is all that was necessary for Forth environments with a
calculator mode REPL like Gforth, and the calculator part providing the
user interface was just a modified version of fdc.4th.
> 2 I've seen you dropped the unit-max table -- and I think that's the
> right choice for a 64-bit system (or even a 32-bit system). You don't
> need that complication.
I did the initial programming for this version of YUKO for fig-Forth on
VAX/VMS with 16-bit integer cells. Even using doubles for everything put
tight limits on some of the unit values, so I thought it was better to
put in maximum value checks than to give incorrect results when values
overflow. When I ported YUKO to Gforth and 4tH, 64-bit integers made me
feel like the maximum value checks weren't necessary.
> 3 I also saw you modified the unit-cstr table -- which is logical as
> well, since 4tH allows you to build string tables with ease. I guess I
> could get these things to work in 4tH, it'll be a nice exercise, but
> this solution is so much clearer and cleaner IMHO!
Working in fig-Forth, I decided it would be easier to identify
convert-to units by interpreting the first four bytes of the input
string as a double instead programming my own string comparison words.
I kept the same approach in the Gforth version. However, it looked like
it would take some effort to implement with 4tH's separate character and
integer segments so I replaced the unit code double table with the more
straight-forward string table.
> 5 I suspected the need for evaluate.4th was not there -- and
> interpret.4th would have sufficed. I tested -- and I was not
> wrong. Sure the thing works fine -- but you carry some dead code
> along. Unless at one time or another you want this thing to load code
> from a block and execute it -- because, that's what evaluate.4th
> allows you to do. It works, because evaluate.4th also loads
> interprt.4th.
I kept the dependency on evaluate.4th from fdc.4th. However, I've tried
replacing the reference to evaluate.4th with interprt.4th directly in
both ydc.4th and idc.4th and they both work fine. I've replaced the
source files on my web site:
https://papa.sdf.org/yuko/ydc.4th
https://papa.sdf.org/yuko/idc.4th
Regarding the underline words (": _+ + ; ...") in ydc.4th, I see that my
initial understanding that an underline word had to be defined for every
word accessible to INTERPRET was incorrect and that underline words are
only needed for 4tH build-in words and not for user-defined words like
the YUKO conversion words. I've also cleaned out the unnecessary
underline words from ydc.4th.
Thanks for your comments.
--
David Meyer
Takarazuka, Japan
pa...@sdf.org