help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: space vs semicolon - why syntax error with the former ? (octave-3.4.


From: Sergei Steshenko
Subject: Re: space vs semicolon - why syntax error with the former ? (octave-3.4.2)
Date: Tue, 16 Aug 2011 15:13:29 -0700 (PDT)


--- On Tue, 8/16/11, Przemek Klosowski <address@hidden> wrote:

> From: Przemek Klosowski <address@hidden>
> Subject: Re: space vs semicolon - why syntax error with the former ? 
> (octave-3.4.2)
> To: address@hidden
> Date: Tuesday, August 16, 2011, 11:33 AM
> On 08/16/2011 01:52 PM, Sergei
> Steshenko wrote:
> > this case - to me it looks like the 'for' loop
> > statement is unambiguously
> > over, and no special separator (e.g. ';') is
> necessary
> 
> > --- On Tue, 8/16/11, CdeMills<address@hidden> 
> wrote:
> >> Sorry, but taking your reasoning literally is
> bogus: let's
> >> consider
> >>   if (0>1) disp('Problem'); end;
> disp(36)
> >> if you take for granted that the 'end' close the
> >> expression, then then
> >> previous line should be equivalent to
> >>   ; disp(36)
> >> which is a syntactically incorrect.
> 
> > Normal languages do not care about semicolon before a
> function call.
> 
> There is no such thing as a 'normal language' in this
> respect. Look up the debate that raged in the nineties on
> whether semicolon should be a separator or a terminator. One
> doesn't have to look far, this is covered in Wikipedia:
> 
> http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28syntax%29
> 
> There are arguments for either style, and the debate ended
> in a tie---it appears that the score among the languages
> listed in the Wikipedia article is 24:21.
> 
> Matlab happens to be one of the few languages with both a
> primary (newline) and secondary (';,') separator---probably
> to make it easier for command line coding; they also
> overloaded the semicolon to control output silencing. It is
> what it is, let's get on with it :)
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
> 

I am widening my question: why comma is more acceptable than space too:

"
octave:1> for ii = 1:1 ii endfor,disp(ii);
ii =  1
 1
octave:2>  
"
?

I still want to see a _logical_ argument about unacceptability of space
in this case.

I reiterate my point: as soon as 'endfunction' is detected, it doesn't
matter that the loop has been found from the point of view of parser.

To me insistence on semicolon or comma or newline and unacceptability of
space (and tab) is an unnecessary nuisance.

Computer languages are formal ones compared to human languages - in order
to achieve disambiguation. I do not see an ambiguity in such a case in the
first place - end of 'for' statement is easily detected by parsing
'endfor' keyword.

Thanks,
  Sergei.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]