From: the.beez.speaks@gmail.com   
      
   On 30-06-2025 21:05, albert@spenarnc.xs4all.nl wrote:   
   > In article ,   
   > Hans Bezemer wrote:   
   >> On 25-06-2025 09:21, Paul Rubin wrote:   
   >>> Hans Bezemer writes:   
   >>>> Fundamentally. I explained the sensation at the end   
   >>>> of "Why Choose Forth". I've been able to tackle things I would never   
   >>>> have been to tackle with a C mindset. ( https://youtu.be/MXKZPGzlx14 )   
   >>>   
   >>> I just watched this video and enjoyed it, but I don't understand how a C   
   >>> mindset is different. In C you pass stuff as function parameters   
   >>> instead of on the stack: what's the big deal? And particularly, the   
   >>> video said nothing about the burning question of locals ;).   
   >>>   
   >>> It seems to me all the examples mentioned in the video (parsing CSV   
   >>> files or floating point numerals) are what someone called   
   >>> micro-problems. Today they much easier with languages like Python, and   
   >>> back in Forth's heyday there was Lisp, which occupied a mindspace like   
   >>> Python does now.   
   >>>   
   >>> I agree that Thinking Forth is a great book.   
   >>   
   >> It's hard to illustrate things with a multi-KLOC program IMHO. You can   
   >> only illustrate principles by using examples that are "contained" in a way.   
   >>   
   >> But I'll try to illustrate a thing or two. Let's say you want to tackle   
   >> a problem. And it doesn't go your way. You have to add this thing and   
   >> that thing - and hold on to that value. You know what I mean.   
   >>   
   >> about to add. Take a look at getopt() - I think that's a good example.   
   >> You can almost see how it grew almost organically by the authors hand.   
   >> He never seemed to think "Hmm, maybe I'll make a separate function of it".   
   >   
   > getopt is a design error in Forth filosofy. You are writing an interpreter   
   > and Forth is the only interpreter, first commandment.   
      
   Sure, don't take the analogy - attack the metaphor. There is no logical   
   fallacy defined for that one, but for the number of times such attempts   
   have been made - it should be.   
      
   Just look at the code - don't take its functionality into consideration.   
      
   Now what SHOULD the pseudo code for that one be:   
      
   : GET-ARGUMENT   
    if the option is not the last character in the argument,   
    take the remainder of the argument as the option value   
      
      
   : PARSE-ARGUMENT   
    if the first character isn't a dash, stop the parsing!   
    the index points to the next non-option argument;   
    loop through the argument string - and execute the word associated   
    with the character   
      
      
   : PARSE-OPTIONS   
    FOR each argument in arguments, PARSE-ARGUMENT   
    until an "stop-parsing" code is received   
      
      
   Now, what does getopt() look like?   
      
   Hans Bezemer   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|