Forth Frustrations



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
self­evident. 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
.



Relevant Pages

  • Re: Forth Frustrations
    ... I found it extremely frustrating to juggle around data on the stack, such as 2 RGBA color components when building a gradient. ... Data structures, not algorithms, are central to programming. ... In the Windows environment, you often have to put together immense lists of parameters for an OS call. ... I'm not at all familiar with Ficl, but the products from FORTH, Inc. as well as other modern Forths I'm familiar with have excellent facilities for setting up application-specific data structures. ...
    (comp.lang.forth)
  • Re: Good book on OOP? HELP!
    ... > honest good book that can give me some good fundamentals about programming ... Arrays are an easier way to handle lots of data, and data structures are ... A class is the pattern for an object, and specifies all the details exactly, ... will not break existing systems if you use the same interface. ...
    (borland.public.delphi.non-technical)
  • Re: Unexpected multicast IPv4 socket behavior
    ... Default route set, src INADDR_ANY: ... src bindto interface address: ... There's no way for the stack to know which interface to originate the traffic from in the case where there is no default route, and no IP layer source information elsewhere in the stack. ... the use of multicast requires that you create a socket and bind to the interface where you wish to send and receive the channel. ...
    (freebsd-net)
  • Re: Bluetooth DDI [Getting Interface via IRP_MN_QUERY_INTERFACE]
    ... IoAttachDeviceToDeviceStack, not the PDO itself. ... this interface is to be notificated about remote devices connecting to your ... of the stack, and not the PDO I intend to, and which I know I shouldn't ... Now the driver is enumerated by the bthport, sending brbs are ok, but my ...
    (microsoft.public.development.device.drivers)
  • Re: Forth Frustrations
    ... 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. ... I've been accused of programming C in Forth, as if that's somehow terrible, but I digress... ... I was thinking that indexed keyed arrays might be an approach, or a completely different language. ...
    (comp.lang.forth)