Re: Optional "then" and "do"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Fernando Bauer wrote:
> 
> Kat wrote:
> > 
> > Larry Miller wrote:
> > > 
> > > yuku wrote:
> > > > 
> > > > I made changes to the parser.e so that the keyword "then" and "do"
> > > > is optional (if the coder wants that it is still accepted).
> > > > 
> > > > Reasons:
> > > > 
> > > > - Less typing
> > > > 
> > > > - Prevent mistakes of writing if <expr> do  and  for <expr> then
> > > >   which I did a lot of times (Kat too)
> > 
> > Confirmed, especially when changing code from one loop form to another to
> > get
> > program flow to use exit correctly. I often wonder why "then" and "do"
> > aren't
> > the same word. 
> 
> Me too. I think both 'do' and 'then' exist to mark the beginning of a
> executable
> block of code. So, if they are synonyms, one of them is superfluous and could
> be eliminated (in my opinion 'then').
> 
> A similar case occurs with '..' (slice operator) and 'to' (historical note:
> ZX81 BASIC uses 'TO' for 'FOR' statements and also for slices). Both have the
> meaning of a range. In this case I would keep with '..'.
> Then, we could write something like this:
> 
> for i = 1..10 do
>    if i=3 do exit end if
> end for
> 
> [snipped]
> 
> Just some provocative thoughts! smile
> 
> - Fernando

Okay, now to that I have to say "yuk!"

I mean, we may as well write
for(i = 0; i < 10; i++) {
/* do something */
}

Which certainly has its own elegance, but it isn't Euphoria.

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu