Artificial limits to the line length is a mistake, it's a totally arbitrary value, and has horrendous knock on effects. People end up choosing bad variable names as otherwise the lines get too long. The intention was to produce readable code that can be viewed and understood, and if that is the intention, then line length should defer to readability, not the other way around.
I had them when I used PygmyForth: F+ F- F* F/ FSIN FCOS FTAN...
Theoretically any Forth that lacks floating point support can have it added pretty quickly. The operations are pretty easy to write. for a 16-bit forth with 32-bit floats you can write a lot of things : FDUP 2DUP;
Where it gets a little harder is how you want to handle the float literals. You have to dig into the implementation specific parts of the outer interpreter (usually INTERPRET) and hook in >FLOAT as a fallback when >NUMBER doesn
You have to dig into the implementation specific parts of the outer interpreter (usually INTERPRET) and hook in >FLOAT as a fallback when >NUMBER doesn't work. (or look for a "." before trying to convert to a float, else try as a double-cell number, then finally as a single cell number)
When I write a Forth compiler I always make the number conversion a vector so the user can extend it easily for floats, DHMS, Ft-inches, or whatever it is they need to work with as literals. If you grab the old vector then it's easy to chain them too.
Sense at last (Score:5, Interesting)
Artificial limits to the line length is a mistake, it's a totally arbitrary value, and has horrendous knock on effects. People end up choosing bad variable names as otherwise the lines get too long. The intention was to produce readable code that can be viewed and understood, and if that is the intention, then line length should defer to readability, not the other way around.
Re: (Score:5, Funny)
Yes! Give me a hard limit of 80 character lines and I'll show you a bunch of 3-letter variable names!
A.
Re: (Score:5, Funny)
How about 1-letter variables? [xkcd.com] (SFW).
Re: (Score:3)
Instead of 1 letter variables, how about store everything on the stack and use color to decide the type [ultratechnology.com] ?
Re: Sense at last (Score:2)
Forth and RPN calculators.
Only headache I had with Forth was the lack of floating point support.
Re: (Score:2)
I had them when I used PygmyForth: F+ F- F* F/ FSIN FCOS FTAN ...
Theoretically any Forth that lacks floating point support can have it added pretty quickly. The operations are pretty easy to write. for a 16-bit forth with 32-bit floats you can write a lot of things : FDUP 2DUP ;
Where it gets a little harder is how you want to handle the float literals. You have to dig into the implementation specific parts of the outer interpreter (usually INTERPRET) and hook in >FLOAT as a fallback when >NUMBER doesn
Re: Sense at last (Score:3)
You have to dig into the implementation specific parts of the outer interpreter (usually INTERPRET) and hook in >FLOAT as a fallback when >NUMBER doesn't work. (or look for a "." before trying to convert to a float, else try as a double-cell number, then finally as a single cell number)
When I write a Forth compiler I always make the number conversion a vector so the user can extend it easily for floats, DHMS, Ft-inches, or whatever it is they need to work with as literals. If you grab the old vector then it's easy to chain them too.