Re: New switch/case idea

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
kinz said...

In standard Euphoria, the word "do" does imply namely the looping or cyclic actions, it is used only in cyclic constructs and nowhere else.

for i=1 to n by 2 do 
     ....... 
end for 
 
while a do 
     ....... 
end while 

No, the "do" notes the start of the basic block of code. The "for" or the "while" are where the looping semantics come from. "do" is the euphoria equivalent to a curly brace in C-like languages. So is 'then' when looking at an if statement.

kinz said...

So I'm free to translate it in its own sense - as marker of cyclic block. In Russian it sounds as cycl.

You can translate it however you like, but that won't change its intended meaning.

kinz said...
DerekParnell said...

It is used as a marker to begin the block of code that is being control by the previous statement. If that previous statement is a looping construct then "do" marks the begining of a loop,

So, what is wrong if the name of the marker of begining of the cyclic actions is cycl, as it is in bilingual EU 2.5 in Russian mode???

You've put extra meaning into that keyword that was never there. It becomes really apparent now that the usage of 'do' has expanded.

kinz said...
DerekParnell said...

if the previous statement is not a looping construct, the "do" marks the begining of a non-looping block. Actually to be very consistent we should be using the syntax ...

if condition do 
  block 
end if 

Wait a minute ... Where did you see if condition do?
The standard Euphoria doesn't have that, it has then marker here, to in Russian mode. And it is very good. In C we have { for all at all markers of begining.

You misread what he said. He said that to be perfectly consistent, we'd have if-do blocks instead of if-then blocks. I think the usage of 'then' is largely historical, from BASIC dialects, and is pretty widely understood.

kinz said...

Is "cycle" still confusing someone?

It will perhaps confuse your Russian users, now that 'do' is used for things other than loops. While others have expressed some opinions regarding alternate ways to mark the start of the block, I don't think that anyone else has mistaken the meaning of 'do' the way that you have.

Matt, there is one more strange construct with that "do" in 4.0:

loop do 
    a = a * 2 
    x = x - 1 
until x<=0 

Why not to use the old good traditional EU style:

do 
    a = a * 2 
    x = x - 1 
  until x<=0 
end do 

Then I'll translate it to Russian with great pleasure:

cycl 
    a = a * 2 
    x = x - 1 
 kogda x<=0 -- kogda means when 
stop cycl 

But loop do is absolutelly ugly thing in Russian. Same about do case - ugly as ... I do not know as, sorry.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu