home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.fortran      Putting John Backus on a giant pedestal      5,127 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,612 of 5,127   
   Andrew to Lawrence D'Oliveiro   
   Re: Implicit Semicolons And Statement-Co   
   06 Feb 24 10:14:20   
   
   From: Doug@hyperspace.vogon.gov   
      
   Lawrence D'Oliveiro wrote:   
   > Fortran (in free-form mode) is now the third language I’ve come across   
   > that allows semicolons to terminate statements, but makes them   
   > optional (letting a newline do the job instead).   
   >   
   > The other two are JavaScript and Python. JavaScript has the most   
   > complex-seeming rule, but once you understand how it works, being able   
   > to write something like   
   >   
   >      f(a, b, c)   
   >   
   > as   
   >   
   >      f   
   >        (   
   >           a,   
   >           b,   
   >           c   
   >        )   
   >   
   > (where a, b and c might be quite complex expressions) is quite useful.   
   >   
   > Python has I think the most straightforward rule: you need to end a   
   > line with “\” to do explicit continuation, but continuation can be   
   > implicit if there is an unpaired opening parenthesis, bracket or   
   > brace. So complex expressions can be written with minimal clutter:   
   >   
   >      section_verts = \   
   >          [   
   >              start + vec(0, - rail_width / 2, 0),   
   >              start + vec(0, rail_width / 2, 0),   
   >              start + vec(0, - rail_width / 2, rail_thickness * slope_adjust),   
   >              start + vec(0, rail_width / 2, rail_thickness * slope_adjust),   
   >          ]   
   >   
   > Free-form Fortran, on the other hand, requires an explicit “&” to   
   > continue a line in all cases:   
   >   
   >      character(len = 9), dimension(3, 4), parameter :: month_names = &   
   >          reshape &   
   >            ( &   
   >              (/ ' January ', ' February', '  March  ', '  April  ', &   
   >              '    May  ', '   June  ', '   July  ', '  August ', &   
   >              'September', ' October ', ' November', ' December' /), &   
   >              (/3, 4/) &   
   >            )   
   >   
   > Wouldn’t it be useful if it had a smarter, Python-style rule?   
   >   
      
   I don't think posting here is going to have any influence on the people   
   who define the Fortran standards.   
      
   Looking at the JavaScript example.  One pair of () brackets is easy to   
   keep track of, multiple nested brackets (complex expressions) can lead   
   to mismatched brackets and very confusing / entertaining syntax errors.   
      
   I have never used Python but my understanding is that indentation is   
   important (or critical) there so you have an extra level of clarity   
   which FF Fortran does not offer.   
      
   Handling syntax errors is important, making sure than syntax errors do   
   not accidentally produce valid syntax (leaving a ")" off in JavaScript,   
   inserting one a couple of lines further down) is also important.  The   
   people who define Fortran standards care about stuff like that.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca