Jump to content
IGNORED

M.U.L.E. for TI


hloberg

Recommended Posts

Forth is compact and maybe also sufficiently fast, but I would call it a "write-only programming language". If you are the program author, you can have some joy with programming bottom-up and putting parts together, and in the end everything works fine, but if you want to understand someone else's Forth program, you not only need lots of documentation; you just cannot easily understand the program behavior without a pencil and paper at your side. This is because almost all program state is kept on a stack which is not visible in the program code. Also, it is farthest away from a natural language kind of readability. I don't have problems when reading C/C++/Java code to quickly get the idea, but all samples of Forth programs I saw so far look like secret code that you have to decipher.

 

I had TEX-Forth and indeed wrote some small programs with it, but was quickly pulled over to C when it became available on the TI.

 

Michael

Link to comment
Share on other sites

Forth is compact and maybe also sufficiently fast, but I would call it a "write-only programming language". If you are the program author, you can have some joy with programming bottom-up and putting parts together, and in the end everything works fine, but if you want to understand someone else's Forth program, you not only need lots of documentation; you just cannot easily understand the program behavior without a pencil and paper at your side. This is because almost all program state is kept on a stack which is not visible in the program code. Also, it is farthest away from a natural language kind of readability. I don't have problems when reading C/C++/Java code to quickly get the idea, but all samples of Forth programs I saw so far look like secret code that you have to decipher.

 

I had TEX-Forth and indeed wrote some small programs with it, but was quickly pulled over to C when it became available on the TI.

 

Michael

And that's why I call Forth cryptic.

If you can't look at code and see what it's doing that makes it difficult to maintain.

For commercial applications, companies want code that can be updated and maintained by people besides just the original programmer.

I guarantee you that even the original programmer will have difficulty walking away from a Forth program for a couple years and then coming back and making requested modifications. It's just too difficult to follow.

 

Forth is great for small things but once you start trying to throw data around all over the place with hundreds of things to process you get totally buried by it's cryptic nature. In my career I've worked on many applications that literally had millions of lines of C++ code which was upgraded/maintained by dozens of people at the same time and software engineers came and went on each project. Attempting such a feat in Forth would be a guaranteed failure.

There is a reason there are no Forth jobs advertised right now. It's just not suited to anything large and it's too difficult to follow.

The Forth standard hasn't even been updated in almost 20 years. That's not because the language is great, it's because there is no demand. Nobody has even proposed a standard library of new words.

Link to comment
Share on other sites

JamesD, check out Willsy's recently programmed Dark star game written in Turbo Forth to see an example of what you can do in Forth on the TI.

The question isn't can you write games in Forth. It's certainly possible.

There was another thread on Forth a while back. There were actually a few games written in Forth in the past as well.

But Forth based games were limited to a handful of programmers, almost all of which turned out only one or two games.

I think one guy wrote 3 adventure games in it but I'd guess he used the same engine on all of them.

Link to comment
Share on other sites

Classes, correct. Brain F**t, been a good year since I did anything in Java. Actually didn't like java much. Just used it to write a few apps for my phone. Gave it up for B4A a compiled BASIC for Android.

Correct me if I'm wrong but aren't the screens in forth limited in size making, essentially, everything to be a subroutine of everything else?

It forces extreme structured programming but I have found that hard to track down problems in.

Of course, I could be wrong.

Link to comment
Share on other sites

Certainly not true. See http://www.forth200x.org/.

 

...lee

From the page:

A new standards process (Forth 200x) for updating the '94 standard is underway. It will produce a formal standards document; proposals for changes to the '94 standard should run through the RfD/CfV process before being discussed at the standards meeting. There is now a mailing list for RfDs/CfVs and other issues related to the Forth 200x effort. It has not been decided whether an official standards body (like ISO) will be involved.

 

This is a proposal. It hasn't been run through ANSI, ISO, or IEEE if you read the info.

Anyone can get a group together and modify or create a language. That does not make it an industry standard.

<edit>

But then look how popular ANSI BASIC was.

Edited by JamesD
Link to comment
Share on other sites

Classes, correct. Brain F**t, been a good year since I did anything in Java. Actually didn't like java much. Just used it to write a few apps for my phone. Gave it up for B4A a compiled BASIC for Android.

Correct me if I'm wrong but aren't the screens in forth limited in size making, essentially, everything to be a subroutine of everything else?

It forces extreme structured programming but I have found that hard to track down problems in.

Of course, I could be wrong.

While each screen has a fixed size of 1k, you can link screens together to make them as large as you need.

Link to comment
Share on other sites

In fact many games were written in Forth at least in the UK where we had a machine called the Jupiter Ace - http://www.jupiter-ace.co.uk/

You can see many games being developed including many from a friend of mine who claims learning forth helped him in his career later in life as it taught him to think differently.

 

There is nothing to stop anyone writing a very cool game for Forth as Mark did with Dark Star. In fact the only thing stopping anyone is the willingness to dive in and give it a go.

TurboForth with the F18A is a powerful combination.

Actually although Forth might appear a dead language...it is very much still out there and appearing on many devices including the wikireader device

I would agree that in general Forth can appear cryptic although that is also due to not knowing many of the built in words and of course choosing the right word names could make a Forth program almost self documenting.

 

As a guy said in Make magazine though its not about which tool you use...its about what you build :-)

Link to comment
Share on other sites

"I have yet to see a decent piece of software written in Forth. Let's face it. Forth stinks." --- John Dvorak, provocateur and columnist, InfoWorld, October 29, 1984.

 

Just sayin...

 

He he! That makes me laugh! Why? Because the biggest Forth hater that I ever met, by a country mile and then some, was me! Then one day I thought that if I was going spout such venom about the language I should really study it, so that, you know, I could dis' it from a position of strength.

 

Oh dear. Big mistake.

 

I discovered just what a genius, gem of a language it is. It's also quite a well covered secret, hidden in plain view, so to speak. It's true that it *is* a very niche language though. I recently met another Forth coder here at work. We just stared at each other in disbelief. It was like we were Masons or something. We are considering adopting a secret handshake :-D . We already have a secret password. You say "one one plus dot" and if the other person says "two" then he is a brother, he is "illuminated" (illumni) and should be treated as one of your own for he is rare and precious. If he looks at you non-plussed then he is one of the non-illuminated; he lives in darkness, un-aware of the bright light that lives in plain view, all around him ;-)

 

It's true that Forth is a code amplifier; if you're a good coder, you can write exquisite Forth. If you're a bad coder, your Forth will seriously suck. This is because you can do *anything* in Forth. There are *no* restrictions, because there is no syntax.

 

With freedom comes great responsibility.

  • Like 1
Link to comment
Share on other sites

And that's why I call Forth cryptic.

If you can't look at code and see what it's doing that makes it difficult to maintain.

I feel your pain. Though I think it's mostly a matter of experience. As I work with Forth source code more and more I get more comfortable with reading other folks' source code. Certain phrases begin to stand out, and one develops the ability the track the stack in ones head (up to a point, of course). Forth is definately a mind expanding programming language. It's gives your brain a thorough workout, that's for sure, especially when you are new to the language.

 

For commercial applications, companies want code that can be updated and maintained by people besides just the original programmer.

I guarantee you that even the original programmer will have difficulty walking away from a Forth program for a couple years and then coming back and making requested modifications. It's just too difficult to follow.

 

Well, Forth's strength is in embedded, resource constrained applications, not so much systems that have an underlying OS. IHMO on such systems, you'd be better off using a language like C or Java or VB. However, there are less and less 'resource constrained' embedded devices around these days. Even 5 cent chips are coming with 32K of flash and 8K of RAM these days; that's not resource constrained. I don't agree with your second comment, however. IMHO, it's just as easy to write vile C++ as it is vile Forth. I have seen well written Forth code, and it is very easy to understand. The secret sauce in Forth is factor factor factor. Factor your code into small definitions. Each being an independantly testable unit in its own right. Most of the time, you can test right there at the keyboard. When it's working properly, you move on. If it's factored nicely, the high-level definitions will read almost like English. The same programmer would have no difficulty at all, and an experienced coder would just need some time to understand the code (and probably would not need to concern himself with the low level code at all). I don't see how that's any different to a C++ project? The "problem" is that a time investment is needed; the language is not the actual problem. If you gave me a C++ application to modify, I'd need a few days to understand it. You need to understand the mind of the programmer. That the langauge is Forth, C++, Haskell or assembler is immaterial, IMHO. A time investment is needed, and the more experienced you are with the target langauge the bigger your advantage.

 

Forth is great for small things but once you start trying to throw data around all over the place with hundreds of things to process you get totally buried by it's cryptic nature.

Then you're doing it wrong ;) - you should aim to never have more than 4 (ideally three) items on the stack. Forth has global variables, and some versions have locals too. My system has them too! It's a matter of choosing the correct technique. As I said earlier, with great freedom comes great responsibility. It's easy to screw up in Forth, there's no doubt about it, because you're free to f**k up in any way you want! Other languages are generally more restrictive.

 

In my career I've worked on many applications that literally had millions of lines of C++ code which was upgraded/maintained by dozens of people at the same time and software engineers came and went on each project. Attempting such a feat in Forth would be a guaranteed failure.

 

To my knowledge, there is no single Forth application that can be measured in millions LoC. That would be an anathema to Forth. It's not what Forth is for. (It's not what C++ is for either, but that's a different discussion!). Forth is a very low level language. If you need a million LoC, then you should be using a higher level language IMHO, and just write the bits that are time-critical in fast, efficient, low level code. That's Forth's sweet spot. It's like an assembly language on steriods. You wouldn't write a stock brokers in-house stock trading app in Assembler would you?

 

There is a reason there are no Forth jobs advertised right now. It's just not suited to anything large and it's too difficult to follow.

The Forth standard hasn't even been updated in almost 20 years. That's not because the language is great, it's because there is no demand. Nobody has even proposed a standard library of new words.

 

I think that's largely true. Forth is not well suited to very large applications. I guess, since you can write DSLs in Forth with ease then it *could* be, but yes, I agree. And time has passed Forth by, I don't think anyone could argue with that. It is still being used, and still being used commercially. It's running in quite a few mobile phones all over the world. You just don't hear about it. But yes, it's as rare as hens teeth. No contest.

Link to comment
Share on other sites

 

I think that's largely true. Forth is not well suited to very large applications. I guess, since you can write DSLs in Forth with ease then it *could* be, but yes, I agree. And time has passed Forth by, I don't think anyone could argue with that. It is still being used, and still being used commercially. It's running in quite a few mobile phones all over the world. You just don't hear about it. But yes, it's as rare as hens teeth. No contest.

OK Willsy, 'Yo da man' when it comes to Forth. So, do you think a large project like MULE may be wrong for Forth?

Gotta say I am fascinated with Forth and will learn it eventually, but MULE may be the wrong project for it is what I'm hearing?

Just wondering?

Link to comment
Share on other sites

I think Forth is fine for MULE, but Forth is wrong for you at the moment! What I mean about that is, if your *end goal* is to produce a working version of MULE for the TI, then use the language that you are most comfortable with. Probably C. That way, your time is spent productively, in the sense that you are working on the *end goal* (writing the game) rather than the language. If you just jumped straight into Forth, you would probably find the barrier to be too high - you'd be spending your time working on learning Forth, not writing the game, which isn't the end goal ;) . You'd then get frustrated and probably give up, and come away with the wrong opinion about Forth, when in reality the bar was simply set too high.

 

Vorticon recently wrote a game in Forth, but the game was a means to an end to learn Forth. The end goal was Forth, not the game :) .

 

So yeah, I'd not be too distracted by Forth at the moment; concentrate on your game, and enjoy that. When it's done, you could look at doing a simpler game in pure Forth. I and others here would be only too willing to offer help and advice. Lee is a rock-hard Forther :grin: . When you go that under your belt, you'd probably find it impossible to resist a version of MULE in Forth, just to see if it could be done :P

Link to comment
Share on other sites

 

So yeah, I'd not be too distracted by Forth at the moment; concentrate on your game, and enjoy that. When it's done, you could look at doing a simpler game in pure Forth. I and others here would be only too willing to offer help and advice. Lee is a rock-hard Forther :grin: . When you go that under your belt, you'd probably find it impossible to resist a version of MULE in Forth, just to see if it could be done :P

 

Thanks, 'XB' then 'C' it is. I'm also toyin' with a version of Megamania later on. That might be more appropriate for Forth.

Link to comment
Share on other sites

This is a proposal. It hasn't been run through ANSI, ISO, or IEEE if you read the info.

Anyone can get a group together and modify or create a language. That does not make it an industry standard.

 

So? Does it matter if it's been put through the standards bodies or not? It's likely that if introduced to the various standards bodies right now (the Forth Technical Committee has not yet decided whether or not to approach any standards bodies) it would be rejected anyway. For a standard to be a standard, it generally has to have been proven in use. Whereas ANS94 has many years of proven use (prior to its adoption as a standard) Forth 200x currently does not (though I guess you could argue it's a maturation of ANS94, since not a lot has changed).

 

In my experience, it has to be a de-facto standard before it stands any chance of being an official standard. Otherwise every Tom Dick and Harry with a wallet big enough would be approaching the standards bodies demanding their version of [insert language of choice here] be standardised. Result? Many standards. When you have many standards, there is no standard!

Link to comment
Share on other sites

Hmm... somehow I have the feeling the topic "I'm gonna do M.U.L.E. for the TI-99/4A" has seriously derailed into a pro/con Forth debate :skull:

Don't know how I keep doing this but several months back I started a topic on XB that degraded into pro/con GPL. Seem to stir up controversy where ever i go. ;)

  • Like 1
Link to comment
Share on other sites

If you're writing it in XB to start with why not just run it through the XB compiler. That way you can use the time you saved to learn Forth!

Thought about it but na. The fun in XB is how much you can squeeze out of it. Plus it's also an excuse for me to write some Assm. routines to speed it up and practice that. Mostly this project is to get me back up to speed in the TI99 world so I'm keeping from any short cuts, for now.

But good suggestion though.

Oh ya, and it might morph into 'C' later.

Edited by hloberg
Link to comment
Share on other sites

Hmm... somehow I have the feeling the topic "I'm gonna do M.U.L.E. for the TI-99/4A" has seriously derailed into a pro/con Forth debate :skull:

 

Well...The opening post certainly invited the discussion. Some of us do get a little passionate at times; but, I really think it's all good. It certainly helps to answer the original question(s).

 

...lee

Link to comment
Share on other sites

My apologies, I'll take any replies about forth to PM.

No apologies needed. Actually I have learned a lot about Forth in this topic, by people presenting it's plus and minuses, that I probably wouldn't have had learned. Helped me make my decision; which was the original reason of the post.

And no one got snarkie but stayed professional. Always a plus. :-D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...