Shop OBEX P1 Docs P2 Docs Learn Events
VOTE!!! Forth or no Forth, that is the question... — Parallax Forums

VOTE!!! Forth or no Forth, that is the question...

mklrobomklrobo Posts: 420
edited 2014-08-07 04:39 in General Discussion
Thanks for your vote!

Would you use forth, or not?

If so, which version would you use, and why?

if not, why?

I will need you help in navigating my use of Forth.
I appreciate everyone's input!:lol:
«13

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2014-08-05 02:50
    I've used PropForth for two Propeller projects (drawbot and scara arm). I chose that Forth because it had libraries to control steppers and servos which was what I wanted to do. I'm not fond of all the dialects of Forth, and like that pfth is attempting to be a standard Forth. I may take a look as it again to see if it has what I need.

    Overall I think Forth's interactivity has appeal, but I still prefer C. Sorry Forth guys.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-08-05 03:39
    Too busy to learn another language.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-08-05 06:31
    Yes, I'm too busy to learn another language as well. That's why I use Forth.

    Sorry... C guys.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-05 06:35
    I would use Forth if I needed an interactive language to run on a Propeller without any external memory. At the moment, I would probably use it if I needed an interactive language even if I did have external memory since I don't think there are any other interactive languages that are as mature as, say, Tachyon. I haven't been following PropForth or pfth so they may be mature as well. I guess there are interpreters based on Femto that might be candidates also but Femto is a much less powerful language.
  • Heater.Heater. Posts: 21,230
    edited 2014-08-05 06:39
    WARNING: Language war imminent. Alert level HIGH. Incoming...

    Cluso,

    Yes, and you'll be more busy if you adopt a primitive unhelpful language.

    Loopy,

    You'd be less busy if you adopted a more sophisticate helpful language.

    No need to be sorry, why would the C, or other language users, be worried about how you waste your life? :)
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-08-05 06:51
    This is a silly poll!

    If I need the things that Forth offers (to me), interactivity, rapid prototyping, some strange internal satisfaction, then I would use Forth.

    If I found some really cool Spin objects that did what I needed, then I would use Spin.

    Likewise if I found really cool C code, I would use C.

    If the Propeller isn't the right processor then you pick something else and adopt/adapt to its language offerings.

    Personally, if I just want to play around or feel like investigating things, I use Forth (it's a genetic defect and I've learned not to fight it)

    If I have a box of nails and want to put some pieces of wood together, I will use a hammer. If I have the screws and want a stronger joint, then it is screwdriver time.

    If I just wanted to put things into wood, then a hammer and nails will be more enjoyable in the long run than a box of screws and a screwdriver (hammering is much easier on the wrists than twisting a screwdriver)...but I do have this really neat screw gun that I use on flooring that is just a blast to use!

    Different horses for different courses......the right tool for the job and all that stuff!

    Life is too short to just sit in one box because years ago someone sat you in that box or told you it was the right box to be sitting in.

    The world is too diverse and full of wonder to not explore and learn!
  • Heater.Heater. Posts: 21,230
    edited 2014-08-05 06:56
    Quite so.

    I wrote much on that "right tool for the job" theme in the other thread where mklrobo brought it up.

    It's a good excuse for a quick language riot though:) So this time I though I'd just go for the grenades.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-05 07:06
    Heater. wrote: »
    Quite so.

    I wrote much on that "right tool for the job" theme in the other thread where mklrobo brought it up.

    It's a good excuse for a quick language riot though:) So this time I though I'd just go for the grenades.
    This isn't much of a language riot. People are being too civilized. We need to stir things up more for a riot.

    C, Spin, and Forth are Smile! You should all program in SNOBOL!
  • mklrobomklrobo Posts: 420
    edited 2014-08-05 07:16
    mindrobots wrote: »
    This is a silly poll!

    If I need the things that Forth offers (to me), interactivity, rapid prototyping, some strange internal satisfaction, then I would use Forth.

    If I found some really cool Spin objects that did what I needed, then I would use Spin.

    Likewise if I found really cool C code, I would use C.

    If the Propeller isn't the right processor then you pick something else and adopt/adapt to its language offerings.

    Personally, if I just want to play around or feel like investigating things, I use Forth (it's a genetic defect and I've learned not to fight it)

    If I have a box of nails and want to put some pieces of wood together, I will use a hammer. If I have the screws and want a stronger joint, then it is screwdriver time.

    If I just wanted to put things into wood, then a hammer and nails will be more enjoyable in the long run than a box of screws and a screwdriver (hammering is much easier on the wrists than twisting a screwdriver)...but I do have this really neat screw gun that I use on flooring that is just a blast to use!

    Different horses for different courses......the right tool for the job and all that stuff!

    Life is too short to just sit in one box because years ago someone sat you in that box or told you it was the right box to be sitting in.

    The world is too diverse and full of wonder to not explore and learn!

    The polls so far, seem to indicate the Forth is good for dedicated applications, because those special apps have libraries that are in the projects
    best interest.
    steppers and motors - PropForth
    stand alone systems for terminal, game, etc purposes. - Tachyon Forth.

    Loopy and Cluso99, which Forth do you use? Thanks.
  • mklrobomklrobo Posts: 420
    edited 2014-08-05 07:29
    :nerd: It would appear that the architecture of the propeller dictates that specialized Forths should be used. This explains
    all the different dialects. You just can not fit every library you want, into the prop, at one time, to do a decent job.
    If this is so, then, if the programmer is programming a multilevel application, he will need different forths for each
    app, then linked together as one. This would suggest that all Forths have a comm link library, then the specialized
    library for the specific function. Could have a standalone forth, a robotic forth, etc, but all in the same family to
    function in a mosaic, controlled by a heirarchey, if necessary. Comments?
  • ElectrodudeElectrodude Posts: 1,658
    edited 2014-08-05 07:56
    Why is the question Forth vs. C? They both lose to Spin.
  • twm47099twm47099 Posts: 867
    edited 2014-08-05 08:01
    Yes, because I find it helps me work interactively and at a low level without having to learn/use PASM (something I intend to do.)

    I like pfth because it is essentially standard forth with a few necessary propeller commands, and Dave has done a nice job of making it understandable. I've used it interactively to learn how to work with cogs and pins and counters and to interface serial devices to the prop. And it is just so easy to write a library of functions without a lot of overhead and extra steps. Everything I've done in forth I could have done (not interactively) in Spin or C, but I'm still trying to get up to speed with Spin (so many ways to do the same thing), and using C requires the use of libraries that are somewhat cryptic (as to what/how they are doing), although I was recently shown where the more basic propC functions can be found.

    The limiting feature with pfth is its speed. For example, interfacing with the Pixy color tracking camera, pfth was just too slow, and I was told that Spin would also be limiting. So I'm working more with C, which for that application is very very much faster, but I still have my issues remembering braces and semicolons (much less when/how to use * and & variables).

    I'd like to learn tachyon because of its speed, but it is different enough from standard forth to be jarring, and I'm not having an easy time picking it up -- probably have to dedicate some time to concentrate on it until it becomes more familiar. I'd like to work with propforth also, but it also has the non-standard forth issues. With both versions, I don't mean the propeller features, which of course are not in the standard, but changes to the forth language - simplest example, differentiating upper and lower case.

    tom
  • Heater.Heater. Posts: 21,230
    edited 2014-08-05 08:02
    Forth++ ?

    Why can't we have object oriented Forth?

    I mean just to make Forth even more hideous, as if that were possible, we could have the Smile backwards syntax of Forth plus the total unmanageability of multiple inheritance and the unmaintainability of the ridged class hierarchy from C++!

    Then we could write code like this:
    par1 par2 par3   \ Leave some parameters lying around on the stack.
                     \ Hope we can find them later!
    class1           \ Push a class on the stack
    class2           \ Push another class on the stack
    extend           \ Combine the 2 parent classes into a child
                     \ (multiple inheritance)
    new              \ Replace the child class on the stack
                     \ with a new instance of it 
    method1          \ Call a method on the new instance
                     \ using those parameters we hope are in the
                     \ right place now!
    

    I will leave it to the reader to suggest a nice syntax for the class definitions.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2014-08-05 08:03
    mklrobo wrote: »
    stand alone systems for terminal, game, etc purposes. - Tachyon Forth.

    Ok, that caught my eye.. Tachyon just got moved up my list a bit.

    I theory here is that the win is spending less time talking/chatting/arguing about which language to use and try them all!

    My list is still so long that I'll never get it completed before P2 arrives.
  • T ChapT Chap Posts: 4,223
    edited 2014-08-05 08:20
    Change the name of Forth and it may get some traction. Forth sucks as a name.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-05 08:24
    Heater. wrote: »
    Forth++ ?

    Why can't we have object oriented Forth?

    I mean just to make Forth even more hideous, as if that were possible, we could have the Smile backwards syntax of Forth plus the total unmanageability of multiple inheritance and the unmaintainability of the ridged class hierarchy from C++!

    Then we could write code like this:
    par1 par2 par3   \ Leave some parameters lying around on the stack.
                     \ Hope we can find them later!
    class1           \ Push a class on the stack
    class2           \ Push another class on the stack
    extend           \ Combine the 2 parent classes into a child
                     \ (multiple inheritance)
    new              \ Replace the child class on the stack
                     \ with a new instance of it 
    method1          \ Call a method on the new instance
                     \ using those parameters we hope are in the
                     \ right place now!
    

    I will leave it to the reader to suggest a nice syntax for the class definitions.
    I created an object-oriented Forth once for the DEC PDP-10. I think that was around 1978.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-08-05 08:27
    David Betz wrote: »
    You should all program in SNOBOL!

    Awesome!!! SNOBOL fight in August!!!!!

    Hmmm......I wonder how much Prolog you could fit into a Prop????
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-05 08:29
    mindrobots wrote: »
    Awesome!!! SNOBOL fight in August!!!!!

    Hmmm......I wonder how much Prolog you could fit into a Prop????
    Or we could go with COBOL. That will give the haters of verbose languages something to complain about!
  • Heater.Heater. Posts: 21,230
    edited 2014-08-05 08:31
    OBC,

    Except I seem to have spent a ridiculous amount of time learning different languages. Turned out to be mostly an unproductive waste of time. For a long time it seemed that every project I joined required learning a new language. Coral, Ada, PL/M, C, C++, JavaScript, a bunch of assemblers and even some lisp and Java at some points in the dim and distant past. Not to mention that whilst studying there was BASIC, Algol and Fortran.

    Of course to get productive in any language requires you be familiar with not just the language but also the morass of libraries that can come with it. Often a much bigger task.

    It's probably a good idea not to bother trying to learn more than a few languages and specialize in one. Make them as different as possible so as to get new ideas rather that just learn new syntax for what is basically conceptually the same.

    Might I suggest:

    1) Some assembly language or other just so you get a feel for how CPUs work.
    2) Forth so that you might be happy about the other languages you are going to meet below, nothing gets worse than this.
    3) C for it's basic, common or garden structured programming approach.
    4) C++ for it's object orientedness
    5) Lisp or Scheme for that funky list processing approach.
    6) Standard ML so you can understand the insanity of those functional programming geeks.
    7) JavaScript for it's prototypical nature. Nirvana at last. So easy.
  • Heater.Heater. Posts: 21,230
    edited 2014-08-05 08:38
    T Chap,
    Change the name of Forth and it may get some traction. Forth sucks as a name.
    Good idea. Unfortunatley the name "Smile" has already been taken for an other programming language. More politely known as just "bf".

    http://www.muppetlabs.com/~breadbox/bf/

    David,
    I created an object-oriented Forth once for the DEC PDP-10. I think that was around 1978.
    Oh my God. And I thought I was joking....

    How did you do those class definitions?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-08-05 08:39
    Actually, I am just getting started with Tachyon.

    I have used PropForth and pfth. In fact, I have done quite a bit with pfth helping a fellow with a kinetic sculpture that needed rather precise lookup tables for stepper motors. He got what he wanted and found that the interactive quality extremely useful in verifying what was going on with quite a few hall effect sensors. The project deployed multiple cogs that started and stopped at different times.

    I suppose all this could be done in C, but it wasn't.

    Pfth was very helpful in allowing me to learn more about PASM and Propeller architecture. I generally feel that C might do more to insulate the user from both those factors.

    C certainly seems more useful in terms of larger programs and aspects such as floating point maths and large data schemes.

    I just feel that Forth, PASM, and C make one more well-rounded.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-08-05 08:41
    mklrobo wrote: »
    The polls so far, seem to indicate the Forth is good for dedicated applications, because those special apps have libraries that are in the projects
    best interest.
    steppers and motors - PropForth
    stand alone systems for terminal, game, etc purposes. - Tachyon Forth.

    Loopy and Cluso99, which Forth do you use? Thanks.

    You really need to do more research before you make such generalizations about ALL the languages and their strengths and weaknesses.

    I've used all 3 and I won't make generalizations as to which is better for what beyond this (in my experience):

    1) PropForth has the best multi-propeller support built in. It is fun to fire up multiple Propellers and hop from COG to COG relatively transparently. It's the oldest and really does have an large collection of add-ons packaged with it. It is slower. The Forth code that makes up the system is well documented and easy to read (if you can read Forth) and you can learn a lot about the implementation from reading through the code.

    2) Tachyon is wicked fast and has some great hardware support and some really nice features that need to be explored more. Peter has been cranking out some wonderful examples and new features. It's becoming my "go to" play Forth. The Forth code that makes up the system is well documented and you can really a lot about programming effective, functional Forth from reading through the sources.

    3) pfth - is the most "standard", has very well documented and easy to read PASM source code and was ported to the P2 so it has some advantages for experimentation and play. It is implemented as a classic Forth and reading through its PASM and Forth sources are a great learning experience.

    I'm not a professional and do this for love, not money so my outlook is dramatically skewed from most who need to put food on the table!

    (Apparently, I need to read less code and write more code! :smile:)
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-08-05 08:44
    Heater. wrote: »
    T Chap,

    Good idea. Unfortunatley the name "Br******k" has already been taken for an other programming language. More politely known as just "bf".

    http://www.muppetlabs.com/~breadbox/bf/

    David,

    Oh my God. And I thought I was joking....

    How did you do those class definitions?

    Gforth has it (in 3 flavors, of course)
    Object-oriented Forth

    Gforth comes with three packets for object-oriented programming, `objects.fs', `oof.fs', and `mini-oof.fs'; none of them is preloaded, so you have to include them before use. The most important differences between these packets (and others) are discussed in section Comparison with other object models. All packets are written in ANS Forth and can be used with any other ANS Forth.

    A good test for pfth ANS compatability - Object pfth!!
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-05 08:49
    Heater. wrote: »
    T Chap,

    Good idea. Unfortunatley the name "Smile" has already been taken for an other programming language. More politely known as just "bf".

    http://www.muppetlabs.com/~breadbox/bf/

    David,

    Oh my God. And I thought I was joking....

    How did you do those class definitions?
    I'm afraid that was in the distant past. I can't recall how I did this. Maybe it was just a bad nightmare. :-)
  • Heater.Heater. Posts: 21,230
    edited 2014-08-05 08:53
    "pfth, pfth, pfth...". Is there some kind of flu virus going around? Hope you all get better soon. Probably best to rest up and go to bed with some nice hot Java.
  • ctwardellctwardell Posts: 1,716
    edited 2014-08-05 09:14
    Heater. wrote: »
    Probably best to rest up and go to bed with some nice hot Java.

    Let me fix that for you Heater: "Probably best to rest up and go to bed with some nice hot Java(script)."

    C.W.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-05 09:15
    What about Bob?
  • Heater.Heater. Posts: 21,230
    edited 2014-08-05 09:39
    David,
    What about Bob?
    I don't want to go to bed with Bob.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-05 10:36
    Heater. wrote: »
    David,

    I don't want to go to bed with Bob.
    Sorry, just trying to drum up interest in my old language.
  • JonnyMacJonnyMac Posts: 9,105
    edited 2014-08-05 11:50
    Thank you. Let's remember that surgeons use more than one type of scalpel.

    mindrobots wrote: »
    This is a silly poll!

    If I need the things that Forth offers (to me), interactivity, rapid prototyping, some strange internal satisfaction, then I would use Forth.

    If I found some really cool Spin objects that did what I needed, then I would use Spin.

    Likewise if I found really cool C code, I would use C.

    If the Propeller isn't the right processor then you pick something else and adopt/adapt to its language offerings.

    Personally, if I just want to play around or feel like investigating things, I use Forth (it's a genetic defect and I've learned not to fight it)

    If I have a box of nails and want to put some pieces of wood together, I will use a hammer. If I have the screws and want a stronger joint, then it is screwdriver time.

    If I just wanted to put things into wood, then a hammer and nails will be more enjoyable in the long run than a box of screws and a screwdriver (hammering is much easier on the wrists than twisting a screwdriver)...but I do have this really neat screw gun that I use on flooring that is just a blast to use!

    Different horses for different courses......the right tool for the job and all that stuff!

    Life is too short to just sit in one box because years ago someone sat you in that box or told you it was the right box to be sitting in.

    The world is too diverse and full of wonder to not explore and learn!
Sign In or Register to comment.