home .. forth .. colorforth mail list archive ..

Re: [colorforth] objects and forth


Comments below...

-----Original Message-----
>From: "David J. Goehrig" <dave@xxxxxxxxxxxxxx>
>Sent: Feb 4, 2009 10:10 AM
>To: colorforth@xxxxxxxxxxxxxxxxxx
>Subject: Re: [colorforth] objects and forth
>
>On Mon, Feb 02, 2009 at 10:29:33PM -0700, vaded@xxxxxxxxxxxxxx wrote:
>> Out of curiosity, given your justified lack of faith in academia, how
>> would you recommend a young adult in today's world went about learning
>> to program? 
>
>There's this wonderful place known as the library :)  Actually, most of the best people programming in the Valley got their starts as children.  I started programming at the age of 7, with the aid of a few books my parents bought for me, and a collection of books borrowed from the library.
>
>> Do you learn the new Forths and hope that somehow you will
>> find employment with that, and thus not "sell out"?
>
>Well, personally, I got my formal training in History, Mathematics, and Classical Languages.  I have found that this has been a positive boon when getting hired, as most of the companies I focused on early in my career were typically looking for people who had more skills than just programming.  That said, it isn't enough to just learn Forth, you do need to learn to hate mainstream languages for all the right reasons :)
>
>> Should people still be learning assembly for the PC and going from
>> there?  Is that the best starting point?  Should the PC be skipped
>> altogether?  What books could even be recommended?  
>
>Wow what a setup!  I've actually been writing a book that details exactly that strategy and process.  The book began because we've been having problems finding students who know enough about systems level programming and bare metal to even be trainable!  I'm currently working with an editor, a sympathetic academic, and a few willing test subjects who need to learn to program this summer.
>
>The way I typically teach programming to newbies, and reteach people who've acquired a theoretical education, is I start off with the bit, and move up from there.  By the end a few days, they've learned enough to do basic assembler.  I then work with them to build a C or Lisp or Smalltalk.  At that point, if they're willing I introduce them to Forth.  There's no point arguing about the merits of Forth with someone who doesn't understand how C operates on the machine level.  Usually at that point, you end up with a novice programmer, who has a firm handle on what C does, and can read/write any C code.  They also are pretty easy to sway to the benefits of Forth, as the multi-level properties blow away the limited world view of C, and everything written on top of it.  Further more, because they typically understand OO programming on the low low level, they know when and how to break from the metaphor.


Catching up on my email... this has been an interesting thread on programming ("paradigms"?). It seems a lot of the problems in mainstream programming don't even arise in Forth. And the ways they are moving to fix these problems seem to be moving towards forth philosophy - it is like they are creating "forth", backwards. I don't have any concrete examples* at the moment though...maybe later :P (tired).
For me trying to learn some C lately, it is quite a change. I tried to use an int which
is the same size as a pointer as a pointer and the compiler wouldn't let me. I like how Forth doesn't "get in your way" or make you have to do dumb "boilerplate" things like declare variables, etc. Ok so you have to define variables, but even then your 99% using the stack. I don't know if that kind of freedom is good for learning programming or good programming habits, though...

*Oh, I thought of a couple examples: context switching overhead: In forth there are no registers to save/restore, or very few. garbage collection/reentrancy/scoping/local variables - forth has a stack (well 2). I don't know: callbacks (could that be considered vectored execution?), and lots more... closures? - kind fuzzy on what they are, but they seem to be a non-issue in Forth.  


>
>As with all things, it will be announced when it is done.
>
>Until then, I recommend reading in no particular order:
>
>The Little Schemer
>The Seasoned Schemer
>On Lisp
>
>Starting Forth
>Thinking Forth
>
>The C Programming Language

I was going to recommend adding SICP to your list (although I've only just started reading it), but someone already mentioned it later in this thread. However seeing the PS below, I thought you'd be interested in this paper:  lisp does seem to be a "prefix" forth...

Linear Logic and Permutation Stacks--The Forth Shall Be First

http://home.pipeline.com/~hbaker1/ForthStack.html

It talks about "Linear Lisp" where you write the Lisp code in such a manner (linear programming) that the operands are used only once, using certain idioms. There is a correspondence between linear lisp and permutation stack machines. The resulting code starts turning out looking very Forth-like. ( it talks about Forth as a system of linear combinators). A very interesting paper (I think I understood most of it, but I think a background in Lisp would help a bit). The Linear Lisp also reminds me of Logo (another Lisp variant - surprising to me, I always thought it was just a turtle!) with its "plumbing diagrams" that ensure every thing is used only once -- or at least makes sure every function output is connected to a function input. (I think; it has been a while since I studied it, and I haven't had much time to actually use it yet, so don't take my word for it.)

I've been thinking of trying to write a Lisp eval() function in Forth. It seems that a simple functional ( though maybe not practical) eval could be written in a page of forth code. ( I could be very wrong, since I really don't know lisp :) I have cons/car/cdr in a couple lines of code, but haven't tried to go beyond that yet, there might be more to it than I expect -- that's one reasons I'm reading SICP!! I will also look for the Lisp/Scheme books you mentioned above.)


Regards,

Lonnie

>
>I think it is important not to forget that Chuck well aware of what McCarthy was doing in 1958 when Lisp was formulated, and the Germans and Americans developed Algol in a comittee that same year.  That was really the critical year in the history of programming, and we've basically been stuck with the idioms formalized in that year.  In many ways, we're still fighting that battle, and sadly the Algol people are winning. :)
>
>Dave
>
>PS. Lisp is just Polish Notation Forth, it about think :)
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
>For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
>Main web page - http://www.colorforth.com
>


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com