Forth Frustrations
- From: George Peter Staplin <georgepsSPAMMENOT@xxxxxxxxxxxx>
- Date: Mon, 2 Apr 2007 13:43:05 +0000 (UTC)
I'm extremely frustrated by Forth lately.
I was working on an interface to my new window system in Ficl. I found
it extremely frustrating to juggle around data on the stack, such as 2
RGBA color components when building a gradient. 8 items or more.
So, I asked in #Forth and was told not to do that, because I shouldn't
have more than 3 or 4 items on the stack at once. My code was horrible
apparently. So, I used allocate, and then I had to call free. I grew
tired of that interface. Then it occured to me that people building
large matrices in Forth would of course have more items on the stack
than that, so the Charles Moore dogma doesn't apply, and it's a bad
dogfood. I suppose people may not even do that with Forth though. The
constraints imposed by the community and Charles Moore have limited
Forth.
So, I came upon another solution. I added a concept that I call a "super
local," to Ficl's C code. A super local works like this:
: quad 4 parse-word (superLocal) ; immediate compile-only
: some-word quad color1 ( pops 4 items ) quad color2
color1 ( pushes 4 items ) ;
Only then did I discover that doesn't really help me in most cases to
reduce complexity. I talked about my (superLocal) in #Forth and was of
course criticized. The Forth community I'm getting the impression likes
to criticize. I've been accused of programming C in Forth, as if that's
somehow terrible, but I digress... I realized that I need a way to get
the cells in an individual super local. That's where I stopped. I was
thinking that indexed keyed arrays might be an approach, or a completely
different language.
Now unmotivated and realizing that the structure really sucks in my Ficl
code by some standards, I wrote some C code and felt much better. I
think C is much easier, because it comes with rich structure abilities
out of the box. As Rob Pike once said in his notes on C:
"Rule 5. Data dominates. If you've chosen the right data structures
and organized things well, the algorithms will almost always be
selfevident. Data structures, not algorithms, are central to
programming. (See Brooks p. 102.)"
I believe page 102 is from the Mythical Man Month, and the subsection of
that reads "Representation is the essence of programming."
I feel sad, because my Forth books have mostly gone to waste. I ordered
them from Forth Inc. years ago, and have read them off-and-on since.
Since I left the Tcl community last year, I've tried to turn to Forth,
but now I find it's just not there. I hate being criticized for using
features of the language, and I see it happen in this newsgroup too.
I'll add my own too; I think that using the return stack words for
temporaries is dirtier than using a local.
So, I expect you all to tell me how wrong I am, and what an awful person
I am for posting this. Tell me how I should use a different language
(again). Go right ahead. You can write me off as a troll if that makes
you feel better. :(
Sincerely,
-George
.
- Follow-Ups:
- Re: Forth Frustrations
- From: humptydumpty
- Re: Forth Frustrations
- From: helmwo
- Re: Forth Frustrations
- From: slava@xxxxxxxxx
- Re: Forth Frustrations
- From: slava@xxxxxxxxx
- Re: Forth Frustrations
- From: Elizabeth D Rather
- Re: Forth Frustrations
- From: Andreas Kochenburger
- Re: Forth Frustrations
- From: John Doty
- Re: Forth Frustrations
- From: J Thomas
- Re: Forth Frustrations
- From: Bruce McFarling
- Re: Forth Frustrations
- From: Brad Eckert
- Re: Forth Frustrations
- From: Andrew Haley
- Re: Forth Frustrations
- Prev by Date: Re: Structured Programming using Forth
- Next by Date: Re: Forth Frustrations
- Previous by thread: Re: RfD: Forth 200x structures version 4
- Next by thread: Re: Forth Frustrations
- Index(es):
Relevant Pages
|