Liste des Groupes | Revenir à cl forth |
On 23-06-2025 07:05, LIT wrote:What you mean "you don't cheat"? Since when?On Sun, 22 Jun 2025 14:35:40 +0000, Hans Bezemer wrote:>
>On 20-06-2025 10:46, LIT wrote:>
>> The claim made 40 years ago was: "Forth's heavy use of the stack for
>> parameter passing [...] it is easy for the beginner to run away with
>> the idea that the stack operators should be employed at every
>> opportunity." The suggestion being there's so much traffic one must
>> use stack juggling to solve it.
>
> How many years ago it was made — it doesn't that matter.
> Pythagorean theorem was made over 2500 years ago, and
> AFAIK it's still actual.
>
>> That's the fear and bogeyman that's regularly trotted out about
Forth.
>> But is it true? None of the colon definitions the authors provide
in
>> their book would indicate it. Each used 0, 1, 2 and occasionally 3
>> parameters. Any variables they employed were sparse and global in
>> nature.
>>
>> How about more comprehensive applications?
>
> Then just compare the two examples from "my"
> thread "May the numbers speak". Is really the
> solution that uses strings of "r> drop nip s>d"
> etc. more clear and comprehensible? Oh, really?
>
> It's what we were talking about - not about
> "one of yours that had 154 colon definitions".
>
> --
You can repair such things by using new stack paradigms. I've added
several ones, most of 'em inspired by others. E.g
>
"swap 3OS with TOS" (SPIN, a b c -- c b a)
"DUP 2OS" (STOW, a b -- a a b)
>
-- and several Return Stack operators like R'@, R"@ and RDROP. They're
not just shorthand, but also a template for stack manipulations.
>
The R-stack operators are excellently suited to store (almost)
constants. The D-stack operators document the intentions of the
programmer.
>
I'm sure your example comes from a "clean up" operation. It cleans up
the stacks. Most probably TOS is a return value, that has to be extended
to a double word (most likely because it is interfaced with a double
word word).
>
One of the techniques I developed is to figure out which stack diagram
is most suited for the next set of operations. You do your stuff to get
there, document the resulting scheme - and the rest of your stack
manipulations are simple and shallow.
>
But of course, you have to do the work. If you're incapable or too lazy
to do the work, yeah, then you will find Forth bites you. Note that C is
a very nice language as well. Beats Forth performance wise - so, what's
there not to like :)
>
Hans Bezemer
Mr. FIFO, that Forth of yours bites you from time to time?
It must have rabies, or something. You may want to take
it to the nearest vet.
No, I'm a good Forth wrangler after 40 years - given all the atrocities
I am willing to rewrite into proper Forth. It's there for all people to
see. I don't cheat. I'm not secretly writing locals infested code.
No, frankly it was more targeted to those who are obviously unable toActually it isn't; it's probably the most "democratic"
write proper Forth. Unwilling to admit it - and unwilling to migrate to
much simpler languages, which are more suited for their limited talents.
>
I can only assume they've run into a wall in private, got angry at the
language instead of themselves - and then tried to turn it into the
abomination they so desperately promote as "the true Forth", which
actually is nothing more than a flawed C in wrapped in a thin Forth
skin.
>
It's silly. I know Forth is an elite language
- but sometimes you have..it's just some people try hard to present themselves
to realize you simply don't belong to that group, not in a million
years.
>
I pity those people. Really. My prayers are for them. Every night.
>
Hans Bezemer
Les messages affichés proviennent d'usenet.