help-octave
[Top][All Lists]
Advanced

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

Re: Suggestion: add do-enddo(condition)


From: Johan Kullstam
Subject: Re: Suggestion: add do-enddo(condition)
Date: 28 Jan 2000 18:11:25 -0500
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.4

Francesco Potorti` <address@hidden> writes:

> Sorry, my previous message was somehow garbled.
> 
> John Eaton wrote:
>      1.      do ... enddo (condition)
>      2.      do ... while (condition)
>      3.      do ... until (condition)
>      4.  repeat ... until (condition)
>      5.  repeat ... while (condition)
> 
> I  don't like  `while', because  of possible  (certain)  confusion while
> reading  sources, as  you  have observed,  so  2 and  5  are ruled  out.
> However, I  like a positive test  (while) much more than  a negative one
> (until),  because in  the case  of `until'  we would  have two  kinds of
> loops:

ok i can agree with the above.  how about

do <body> whilst (cond)?

whilst is not while and the emacs mode could easily grok it.

> while () ... endwhile
> do/repeat ... until ()
> 
> which are different in two orthogonal ways:
> - test made at beginning/end
> - positive/negative test
> 
> I think it is better to have  only a single difference.  I see this as a
> simplicity issue in the definition of the language.

i am all for simplicity.

> Moreover, the  `do/repeat ... until()'  construct is different  from all
> other loops, which can be ended with and end* keyword.
> 
> I propose the following, that should address these two issues:
> 
>    do ... enddo while (condition)
> 
> or alternatively
> 
>    repeat ... endrepeat while (condition)

argh.  imho this is worse than the disease.  no construct has garbage
after the end<form> either so it's not like it's conforming to
anything.  this form is going to be weird by its very nature.

> Obviously this means  that we need two keywords to  end the loop: `enddo
> while'  or `endrepeat  while', and  this is  not nice,  but at  least it
> does address the two above issues.

no it doesn't.  people and emacs will still be confused by the context
sensitive "while" keyword.  it doesn't solve the problem (two kinds of
while) while at same time adding gratuitous verbiage.

-- 
J o h a n  K u l l s t a m
address@hidden
Don't Fear the Penguin!



-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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