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.
I've always maintained that more people have implemented Forth than have used it for a project.
That said, I absolutely love Forth. It wasn't really interested in it until I ran across this IOCCC entry: http://www.ioccc.org/1992/buzzard.2.design [ioccc.org] (I'm amazed it's still around!)
It was like a revelation. I highly recommend writing something like that, and seeing how far you can build up the language from within itself.
Some years back, I was able to get blocks and infix expressions working -- with no more cod
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:Sense at last (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: (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.
Re: (Score:1)
I wrote a forth interperter (in assembly with guidence from a book) that worked. But never actually got the language itself.
Re: (Score:2)
I've always maintained that more people have implemented Forth than have used it for a project.
That said, I absolutely love Forth. It wasn't really interested in it until I ran across this IOCCC entry: http://www.ioccc.org/1992/buzzard.2.design [ioccc.org] (I'm amazed it's still around!)
It was like a revelation. I highly recommend writing something like that, and seeing how far you can build up the language from within itself.
Some years back, I was able to get blocks and infix expressions working -- with no more cod
Re: (Score:2)
Forth.
I enjoyed forth back in the day, when 'putering was a hobby and not a significant part of my vocation.
It was, and still is, the best write-only language ever!
And The Inspiration for Yoda talk it was.
Re: Sense at last (Score:2)
Bumper Sticker:
Forth 3 if honk then
Re: Sense at last (Score:2)
(ASCII heart showed up as a 3)