From: rjh@cpax.org.uk   
      
   On 19/01/2023 1:38 pm, Stefan Ram wrote:   
   > Richard Heathfield writes:   
   >> This was a perennial comp.lang.c topic back in the day.   
   >   
   > But what about writing a scanner in languages with automatic   
   > memory management where reading a whole line is very simple   
   > and assuming an input language that limits line length to   
   > some reasonable value, say, 1,000,000 characters?   
   >   
   > In such a language, would there still be reasons not to   
   > read the whole line into memory, but to read it char-by-char   
   > as traditional scanners do?   
      
   There are always reasons, and sometimes they conflict.   
      
   For example, memory management, which should be done by the   
   language because it's too important to be left to the programmer,   
   and which should be done by the programmer because it's too   
   important to be left to the language.   
      
   What are your priorities? Run speed? Speed of development? Code   
   re-use? Scalability? Programmer cost? Robustness? Security?   
      
   And what are your constraints?   
      
   I'm not asking for your answer to these questions. I'm just   
   pointing out that the answer to your question will depend at   
   least in part on the answers to mine.   
      
   --   
   Richard Heathfield   
   Email: rjh at cpax dot org dot uk   
   "Usenet is a strange place" - dmr 29 July 1999   
   Sig line 4 vacant - apply within   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|