Forth And Philae

Point out news stories, on the net or in mainstream media, related to polywell fusion.

Moderators: tonybarry, MSimon

Post Reply
MSimon
Posts: 14334
Joined: Mon Jul 16, 2007 7:37 pm
Location: Rockford, Illinois
Contact:

Forth And Philae

Post by MSimon »

Houston? We No Longer Have A Problem

I discuss Forth and Philae. And also why I'm using it as the control language for Open Polywell.
Engineering is the art of making what you want from what you can get at a profit.

JoeP
Posts: 523
Joined: Sat Jun 25, 2011 5:10 am

Re: Forth And Philae

Post by JoeP »

As a developer, I haven't had the opportunity to use Forth professionally, or even as a student.

I looked at the Wikipedia entry. The reverse polish notation drives me a little crazy as I'm not used to it, although it isn't a big deal.

I did have APL ages ago in High School which is another one of those languages of that era that seemed very cool, but didn't develop into a mainstream language.

So, why are you using Forth, and what makes it superior to things like C for the applications you are building (control board, firmware..)?

MSimon
Posts: 14334
Joined: Mon Jul 16, 2007 7:37 pm
Location: Rockford, Illinois
Contact:

Re: Forth And Philae

Post by MSimon »

JoeP wrote:As a developer, I haven't had the opportunity to use Forth professionally, or even as a student.

I looked at the Wikipedia entry. The reverse polish notation drives me a little crazy as I'm not used to it, although it isn't a big deal.

I did have APL ages ago in High School which is another one of those languages of that era that seemed very cool, but didn't develop into a mainstream language.

So, why are you using Forth, and what makes it superior to things like C for the applications you are building (control board, firmware..)?
The development is about 10X faster. It encourages building code in small fragments ( the cost of a subroutine call is low) the way it is supposed to be done. Testing is easy and very interactive (if desired). And the resultant code is smaller than "C" generally produces. You are not at the mercy of compiler writers. Very little is hidden.

You do not have to do casting fiddles - bits are bits.

There is no checking (except rudimentary) on code. No type checking. So you have to watch yourself. Objects are a breeze. You have data. And you have a method. They are separate.
Engineering is the art of making what you want from what you can get at a profit.

JoeP
Posts: 523
Joined: Sat Jun 25, 2011 5:10 am

Re: Forth And Philae

Post by JoeP »

MSimon wrote:
JoeP wrote:As a developer, I haven't had the opportunity to use Forth professionally, or even as a student.

I looked at the Wikipedia entry. The reverse polish notation drives me a little crazy as I'm not used to it, although it isn't a big deal.

I did have APL ages ago in High School which is another one of those languages of that era that seemed very cool, but didn't develop into a mainstream language.

So, why are you using Forth, and what makes it superior to things like C for the applications you are building (control board, firmware..)?
The development is about 10X faster. It encourages building code in small fragments ( the cost of a subroutine call is low) the way it is supposed to be done. Testing is easy and very interactive (if desired). And the resultant code is smaller than "C" generally produces. You are not at the mercy of compiler writers. Very little is hidden.

You do not have to do casting fiddles - bits are bits.

There is no checking (except rudimentary) on code. No type checking. So you have to watch yourself. Objects are a breeze. You have data. And you have a method. They are separate.
Sounds efficient for constrained systems, and I like how the data/stack machine structure is leveraged throughout the design. Kind of like how Lists are so central in Lisp.

I've gone back and forth on both strongly typed and weakly typed languages -- or contextually typed. In practice I find I prefer compiler enforced, strong datatypes, but that is probably because I've been coding in languages that are that way. And also since I have to usually work on teams and read other peoples code. So someone can be lazy and start using a variable typed as char and later use it as an int I find it irritating and confusing, unless there is a good reason for it. Explicitly casting is still required in some cases, and that is kind of kludgey, so I see why you might rather just throw the concept out.

hanelyp
Posts: 2261
Joined: Fri Oct 26, 2007 8:50 pm

Re: Forth And Philae

Post by hanelyp »

In my experience FORTH development is several times slower than C. You're forced to develop code in small pieces in order to manually keep track of the stack. C lets you hang yourself, FORTH requires serious effort not to.

The low call overhead in FORTH is only realized in the real world if you have stack based hardware fitting the language. If you run the language in a bytecode interpreter you can get very small program sizes, but the interpretor is typically making a subroutine call for every operation.
The daylight is uncomfortably bright for eyes so long in the dark.

MSimon
Posts: 14334
Joined: Mon Jul 16, 2007 7:37 pm
Location: Rockford, Illinois
Contact:

Re: Forth And Philae

Post by MSimon »

hanelyp wrote:In my experience FORTH development is several times slower than C. You're forced to develop code in small pieces in order to manually keep track of the stack. C lets you hang yourself, FORTH requires serious effort not to.

The low call overhead in FORTH is only realized in the real world if you have stack based hardware fitting the language. If you run the language in a bytecode interpreter you can get very small program sizes, but the interpretor is typically making a subroutine call for every operation.
If you have to keep track of the stack you are not in the right frame of mind. I hardly ever think of the stack when developing.

Real world experience. The company I was working for was in a government shoot out with another company for a contract. The government would suggest some hardware and software features. I'd do the hardware design - and me and two coders would have the whole thing done in a month. Collins and its 30 "C" folks would not be quite done in 6 months. That made us 60X as productive. Then the government would have some new suggestion. Same drill. Every time.

The coders? They had never seen Forth until I taught it to them in 3 days.

Every one deep into Forth reports the same sort of thing. But hey. Don't listen to me. I love having a competitive advantage.

And BTW our Forth runs on 32 bit ARM. Yeah. We have plans for our own chip. But that is down the road.
Engineering is the art of making what you want from what you can get at a profit.

Post Reply