Sujet : Re: on Perl
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.unix.programmer comp.lang.misc comp.unix.shellDate : 17. Apr 2024, 20:52:06
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uvp996$1p6tk$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
User-Agent : Mozilla Thunderbird
On 17/04/2024 21:19, John Ames wrote:
On Wed, 17 Apr 2024 21:05:03 +0200
David Brown <david.brown@hesbynett.no> wrote:
Another thing about Forth is that it gives C a run for its money in
potential for obfuscation :
>
: 1 2 ;
1 1 + .
>
Redefine "1". That'll keep the reader on his/her toes!
Redefinitions *stack,* too, so "foo" can mean multiple completely
different things in different contexts depending on which definition
was current at the time.
: foo 2 * ;
: double foo ;
3 foo .
: foo 1 + ;
3 foo .
3 double .
Genuine Forth-heads do staggering things (implementing OOP, etc.) with
this; personally, it gives *me* the willies.
That's why mastering Forth takes a lot longer than just learning the language!
I think that when finding the definition of a word, Forth just searches back through the stack of definitions until it gets a hit. And if that word definition uses other non-primitive words, it goes backwards from where it currently is, looking only at definitions from before the current word was defined. Is that right? And if so, can you do "forward declarations", and mutual recursion somehow?
(I guess this is getting way off-topic for comp.unix.shell, and pretty questionable for comp.unix.programmer - I don't know how much the regulars there try to stay on-topic, or if they like threads like this. I'll happily remove those groups from posts if there is objection to it, but I don't want to cut out people who are interested if they want the posts there.)