What is Forth?
Re: What is Forth?
I just stumbled over this bare-metal Forth on RPI, pijFORTHos (https://github.com/organix/pijFORTHos), which I'd like to recommend to a more general group of Forthwrights because it contains the brilliantly commented syntax of its x86 parent: https://github.com/organix/pijFORTHos/b ... orth.s.txt . Its a model implementation of a DTC Forth with lots of cute ASCII drawings. That is the link to the assembler core, the higher-level words are here: https://github.com/organix/pijFORTHos/b ... orth.f.txt
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: What is Forth?
I can't be 100% sure, Scot, because x86 assembly and ARM assembly both give me a headache, but it looks like those implementations to which you linked are ITC rather than DTC, based on what looks like a raw address in each CFA instead of raw machine code in each CFA, the latter of which is one of the defining characteristics of DTC. In other words, a DTC secondary's CFA would contain a "JSR DOCOL" instead of a "DW DOCOL", according to my limited understanding.
I agree with you that the plain English commenting is superb, but I find the paucity of stack comments in the x86 version to be an issue, at least for the primitives in the .s file.
Mike B.
I agree with you that the plain English commenting is superb, but I find the paucity of stack comments in the x86 version to be an issue, at least for the primitives in the .s file.
Mike B.
Re: What is Forth?
barrym95838 wrote:
I can't be 100% sure, Scot, because x86 assembly and ARM assembly both give me a headache, but it looks like those implementations to which you linked are ITC rather than DTC, based on what looks like a raw address in each CFA instead of raw machine code in each CFA, the latter of which is one of the defining characteristics of DTC.
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: What is Forth?
This essay from Jeff Fox is about Forth hardware and software, not 65anything, but is relevant to the topic title anyway. It's 16 years old but still has relevant philosophy, about computing power versus silicon price and power consumption (Forth processors coming out very strong), whether or not you even need an OS (Forth often acts as its own OS), context-switching speed (Forth again comes out a winner), development speed (again Forth comes out a winner), acceptance by those who don't want to consider a better alternative that they're not familiar with (this is the area where Forth does poorly), etc..
http://www.ultratechnology.com/plan9.htm
http://www.ultratechnology.com/plan9.htm
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: What is Forth?
GARTHWILSON wrote:
This essay from Jeff Fox is about Forth hardware and software, not 65anything, but is relevant to the topic title anyway. It's 16 years old but still has relevant philosophy, about computing power versus silicon price and power consumption (Forth processors coming out very strong), whether or not you even need an OS (Forth often acts as its own OS), context-switching speed (Forth again comes out a winner), development speed (again Forth comes out a winner), acceptance by those who don't want to consider a better alternative that they're not familiar with (this is the area where Forth does poorly), etc..
http://www.ultratechnology.com/plan9.htm
http://www.ultratechnology.com/plan9.htm
The reality is Forth remains a niche environment that doesn't fit well with many common computing tasks. Your average, non-technical computer user is not going to look at an environment that is RPN-based and can be made to self-destruct through simple mistakes. I've been using and programming computers of one sort or another since the latter 1960s and while I've read about and understand the basics of Forth, I have yet to encounter any good reason to invest time in it. When I'm a computer user, as opposed to a programmer, I want to be able to, using an automotive analogy, drive the car without having to first put it together. That's not Forth. If I'm a computer programmer, I necessarily have to develop in the language that will suit the task. That usually won't be Forth, since most of my professional programming is for clients who are not and never will be running Forth.
Forth is great for geeks and nerds, and terrible for the rest of the computing population. Or, to borrow a phrase posted by someone else around here, Forth got voted off the island years ago.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: What is Forth?
I sense a twinkle in your eye, BDD, as you must surely be aware that your post is provocative.
I haven't read Jeff Fox's article, and I don't necessarily defend all claims made by him regarding Forth. It's possible he stated his case too zealously. Talk to him about that. What I will say is that Forth's interactivity makes it extremely fast to develop code with, and this boon doesn't come at the cost of sluggish performance or bloated memory consumption.
And yet you're willing to write in assembly? -- a language that can be made to self-destruct through simple mistakes?
You don't seem to recognize that your clients could run Forth and be unaware that they're doing so, just as they could run code written in C or BASIC without being aware. And the code could run under Linux.
IMO it's clear your grasp of Forth basics is incomplete. To be fair, even a large amount of reading may not be enough. You have to spend some time in the driver's seat (using the automotive analogy).
-- Jeff
I haven't read Jeff Fox's article, and I don't necessarily defend all claims made by him regarding Forth. It's possible he stated his case too zealously. Talk to him about that. What I will say is that Forth's interactivity makes it extremely fast to develop code with, and this boon doesn't come at the cost of sluggish performance or bloated memory consumption.
Quote:
I necessarily have to develop in the language that will suit the task.
Quote:
That usually won't be Forth, since most of my professional programming is for clients who are not and never will be running Forth.
Quote:
I've read about and understand the basics of Forth
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: What is Forth?
Dr Jefyll wrote:
... I haven't read Jeff Fox's article, and I don't necessarily defend all claims made by him regarding Forth. It's possible he stated his case too zealously. Talk to him about that ...
http://www.legacy.com/obituaries/sfgate ... =151440780
Mike B.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: What is Forth?
Dr Jefyll wrote:
I sense a twinkle in your eye, BDD, as you must surely be aware that your post is provocative.
Quote:
What I will say is that Forth's interactivity makes it extremely fast to develop code with, and this boon doesn't come at the cost of sluggish performance or bloated memory consumption.
Quote:
Quote:
I necessarily have to develop in the language that will suit the task.
Quote:
Quote:
That usually won't be Forth, since most of my professional programming is for clients who are not and never will be running Forth.
Quote:
Quote:
I've read about and understand the basics of Forth
x86? We ain't got no x86. We don't NEED no stinking x86!
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: What is Forth?
It takes a lot of experience in Forth to truly grasp how much capability is there. One cannot make a valid judgment from the outside. It is common for even newish Forth enthusiasts to think there are certain things Forth would not be able to do well or even at all; but as they gain experience, they find that not only can it do them, but offers very elegant solutions for them. It happened to me, and it still continues to, even after 25 years. Those solutions tend to be non-obvious, because instead of being canned and advertised or even put in a manual, it's just that the tools are there waiting for you to do things with them that perhaps no one else has done. There's a flexibility there that I have not seen in any other language.
Regarding applications, Jeff Fox does say in the essay,
I would add that what "conventional thinking" is (the postfix vs. infix notation thing) may depend on the individual. I much prefer postfix and using a data stack and getting rid of the piles of parentheses. I understand that the Korean language is post-fix, so Koreans tend to pick up Forth more naturally than Americans do. English is my first speaking language, but not the first language I learned to read and write in. (Spanish is.) That may have some influence on my thinking. In someone's musings (name withheld to protect the guilty) on language implementations on the 6502, he says that errors in data-stack manipulation are a serious problem in Forth. This shows his inexperience with it. Actually, you could write an infix parser in Forth, but I've never heard of anyone wanting to after they come up to speed in Forth. As for crashes, I very seldom get a crash when developing software in Forth, and when I do, I can usually recover in a couple of seconds, without re-loading software, and I usually realize right away what I did wrong. No debuggers, etc. needed.
Forth has run entire hospitals and airports with all their business and administrative tasks; so I don't think there's any shortage of capability for business applications. Forth, Inc. offers their SwitfForth which includes object-oriented programming and all the tools to integrate with Windows, Linux, and Mac OS X. Please see https://www.forth.com/swiftforth/ .
Regarding development speed, a quote from Jeff Fox's essay which I've seen corroborated in Forth, Inc.'s literature:
Regarding run speed, memory required, and power taken, Jeff Fox says:
Regarding "using an automotive analogy, drive the car without having to first put it together," yes, that has been a problem in the '02 Forth world. I have a pipe dream of porting my Forth (which is far more extensive than FIG's) to someone's SBC they're selling and making a turnkey system that gives results right out of the box. This does exist for PCs though, reference again Forth, Inc.'s SwiftForth.
yes, sad news
Regarding applications, Jeff Fox does say in the essay,
- no single operating system or programming language is ideal over the whole range of machines and application domains
I would add that what "conventional thinking" is (the postfix vs. infix notation thing) may depend on the individual. I much prefer postfix and using a data stack and getting rid of the piles of parentheses. I understand that the Korean language is post-fix, so Koreans tend to pick up Forth more naturally than Americans do. English is my first speaking language, but not the first language I learned to read and write in. (Spanish is.) That may have some influence on my thinking. In someone's musings (name withheld to protect the guilty) on language implementations on the 6502, he says that errors in data-stack manipulation are a serious problem in Forth. This shows his inexperience with it. Actually, you could write an infix parser in Forth, but I've never heard of anyone wanting to after they come up to speed in Forth. As for crashes, I very seldom get a crash when developing software in Forth, and when I do, I can usually recover in a couple of seconds, without re-loading software, and I usually realize right away what I did wrong. No debuggers, etc. needed.
Forth has run entire hospitals and airports with all their business and administrative tasks; so I don't think there's any shortage of capability for business applications. Forth, Inc. offers their SwitfForth which includes object-oriented programming and all the tools to integrate with Windows, Linux, and Mac OS X. Please see https://www.forth.com/swiftforth/ .
Regarding development speed, a quote from Jeff Fox's essay which I've seen corroborated in Forth, Inc.'s literature:
- We have many examples where the smaller team of Forth programmers finished the project much faster than the larger team of 'C' programmers. The typical ratio in required man-months is about ten to one.
Regarding run speed, memory required, and power taken, Jeff Fox says:
- There are also many examples where the resultant code generated in 'C' was simply too slow or too big or too power hungry to meet the application requirements and where Forth came to the rescue.
Regarding "using an automotive analogy, drive the car without having to first put it together," yes, that has been a problem in the '02 Forth world. I have a pipe dream of porting my Forth (which is far more extensive than FIG's) to someone's SBC they're selling and making a turnkey system that gives results right out of the box. This does exist for PCs though, reference again Forth, Inc.'s SwiftForth.
Quote:
Sadly, Mr. Fox is no longer with us. A heart attack took his life in 2011.
yes, sad news
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: What is Forth?
BigDumbDinosaur wrote:
Or, to borrow a phrase posted by someone else around here, Forth got voted off the island years ago.
Re: What is Forth?
Forth's strengths should be found, I think, in severely constrained systems.
Another possible advantage is in learning: does Forth illuminate aspects of computer science which are interesting, which are not illuminated by other languages? I think so. It can show us something about how computation can be organised. That doesn't mean it's necessarily a good first language, of course, and I suspect it isn't.
Another aspect of a programming language is its suitability as an engineering tool - and for that, I'd be interested to hear informed opinions: particularly, has anyone ever had experience in a team environment, writing Forth to solve a problem and needing to maintain the solution over time? (Let's take three people as the minimum team size for this purpose.)
Another possible advantage is in learning: does Forth illuminate aspects of computer science which are interesting, which are not illuminated by other languages? I think so. It can show us something about how computation can be organised. That doesn't mean it's necessarily a good first language, of course, and I suspect it isn't.
Another aspect of a programming language is its suitability as an engineering tool - and for that, I'd be interested to hear informed opinions: particularly, has anyone ever had experience in a team environment, writing Forth to solve a problem and needing to maintain the solution over time? (Let's take three people as the minimum team size for this purpose.)
Re: What is Forth?
Quote:
Outside of 6502.org, I have seen very little enthusiasm for Forth.
Quote:
It is common for even newish Forth enthusiasts [...], they find that not only can it do them, but offers very elegant solutions for them. [...]. Those solutions tend to be non-obvious, because instead of being canned and advertised or even put in a manual, it's just that the tools are there waiting for you to do things with them that perhaps no one else has done.
Quote:
I would add that what "conventional thinking" is (the postfix vs. infix notation thing) may depend on the individual. I much prefer postfix and using a data stack and getting rid of the piles of parentheses.
Quote:
a quote from Jeff Fox's essay [...]
Regarding run speed, memory required, and power taken, Jeff Fox says:
Regarding run speed, memory required, and power taken, Jeff Fox says:
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: What is Forth?
Bregalad wrote:
Quote:
Outside of 6502.org, I have seen very little enthusiasm for Forth.
Quote:
Quote:
It is common for even newish Forth enthusiasts [...], they find that not only can it do them, but offers very elegant solutions for them. [...]. Those solutions tend to be non-obvious, because instead of being canned and advertised or even put in a manual, it's just that the tools are there waiting for you to do things with them that perhaps no one else has done.
Not really. You can get up to speed with the mundane stuff pretty quickly. It's the more creative stuff that takes time to see the possibilities of, for example, to envision and create new defining words to accomplish the job much more efficiently. Also, note that everything one might consider to be part of the compiler comes to only a couple hundred bytes in '02 Forth.
Quote:
Quote:
I would add that what "conventional thinking" is (the postfix vs. infix notation thing) may depend on the individual. I much prefer postfix and using a data stack and getting rid of the piles of parentheses.
The latter part is so true. Most of programming is just the logical step-by-step stuff, not mathematical formulae, and infix would have the least benefit for that. For the math, if you really want the algebraic notation, you can put it in the comments, then you'll have both. Algebraic (infix) tells you what you get. RPN (postfix) tells you how you get there.
Quote:
Quote:
a quote from Jeff Fox's essay
Why would you say that? It's not bias. It's experience. He had far more experience in it than anyone else here, probably even Brad Rodriguez. And look at his accomplishments with Chuck Moore, accelerating software by factors of anywhere from a hundred to a thousand. He also wrote the essay, "Low-Fat Computing." He does skewer a lot of sacred cows. It's way past time for someone to do that.
If a newcomer really wants to know what Forth is, I doubt they'll read all the way to page 4 of this topic.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: What is Forth?
Bregalad wrote:
Quote:
Outside of 6502.org, I have seen very little enthusiasm for Forth.
Bregalad wrote:
Quote:
It is common for even newish Forth enthusiasts [...], they find that not only can it do them, but offers very elegant solutions for them. [...]. Those solutions tend to be non-obvious, because instead of being canned and advertised or even put in a manual, it's just that the tools are there waiting for you to do things with them that perhaps no one else has done.
Bregalad wrote:
Quote:
I would add that what "conventional thinking" is (the postfix vs. infix notation thing) may depend on the individual. I much prefer postfix and using a data stack and getting rid of the piles of parentheses.
bregalad wrote:
Quote:
a quote from Jeff Fox's essay [...]
Regarding run speed, memory required, and power taken, Jeff Fox says:
Regarding run speed, memory required, and power taken, Jeff Fox says:
Re: What is Forth?
I am neither for or against any language, including Forth. I was just pointing out it's usage outside of this forum is extremely marginal, which do not mean the language is any better or worse than anyother.
I learned the basics of Forth because enthusiasts on 6502.org convincted me to do so, and yet I still don't know what to do with that knowledge. I just learned the basics, knowing how to deal with the stack is great and all, but not sufficient for an actual computer program, where concepts such as arrays, structure, memory allocation and strings comes very early and are not natively implemented in Forth, meaning you have to implement your own (which is probably not complicated but still). I think the major reason I wasn't able to get further is that the books I found sucked. I really hope I'll be able to continue and write actual program in Forth however, after I find a good book.
WHAT ?
I think that, 1. everything is worth learning and 2. particularly if it's simple, since it makes the learning process faster.
The understanding I had of Forth is that the language itself is extremely bare-bones, but it is extremely extensible to compensate for that, and allow you to do very complicated things with a few "words". This is nothing special as any program that supports function (a.k.a. subroutines or procedures) can do that, but the way it is syntaxed and factored out with words is more elegant, and I like the concept. Again the only reason I didn't went further is the lack of decent learning material offline, and the fact there was no immediate need for it.
I learned the basics of Forth because enthusiasts on 6502.org convincted me to do so, and yet I still don't know what to do with that knowledge. I just learned the basics, knowing how to deal with the stack is great and all, but not sufficient for an actual computer program, where concepts such as arrays, structure, memory allocation and strings comes very early and are not natively implemented in Forth, meaning you have to implement your own (which is probably not complicated but still). I think the major reason I wasn't able to get further is that the books I found sucked. I really hope I'll be able to continue and write actual program in Forth however, after I find a good book.
Quote:
Nothing worth learning [...] is simple.
I think that, 1. everything is worth learning and 2. particularly if it's simple, since it makes the learning process faster.
The understanding I had of Forth is that the language itself is extremely bare-bones, but it is extremely extensible to compensate for that, and allow you to do very complicated things with a few "words". This is nothing special as any program that supports function (a.k.a. subroutines or procedures) can do that, but the way it is syntaxed and factored out with words is more elegant, and I like the concept. Again the only reason I didn't went further is the lack of decent learning material offline, and the fact there was no immediate need for it.