Re: New switch/case idea

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

I'd like to be a bit more specific, sorry:

switch X on  -- this 'on' is a specific sensible and intelligent 
   case a ?1 -- marker, it is clear constuct for translation 
   case b ?2 -- to Russian and using it in pure Russian, pure 
   else   ?3 -- English or any mixed English-Russian mode. 
end switch   -- It is good known word from BASIC. 

Russian version, for example, not final:

vetvv X na   -- means branch X on 
   putt a ?1 -- means way 
   putt b ?2 -- means way 
   inache ?3 -- means else 
stop vetvv   -- means end branch 

Do you ask me about such a thing? I like it, if so.

I like your example. If I understand your idea correctly, then I give my full support to it.

My idea was and is simple.
First of all, to give some concrete try to your too elastic suggestion "switch ... on" for Bilingual Euphoria - BEu for short - http://www.youtube.com/watch?v=L_L5qaen3Zg smile BEu is very sensitive to slightest changes in syntax and resists against any excess in code over standard Eu. So, work on BEu is not too easy, especially if the English syntax changes too quickly. Imagine please - stitching of Russian and English in Euphoria without puckers.
BEu just now at the same time, can use any mix of English and Russian 100% syntax plus identifiers in any languages - all 128..255 codes are allowed for them.
Try please to find yet another language with these features among 8500 known languages.

Then, 'on' is better than 'do' in 'switch', but it is far from sugar too, it is just some marker here, form of comment or such. But if you have a ready series of constructs with 'on', some time, it can be strongly necessary - see please my post about 3-rd 'do' in cyclic constructs.

jimcbrown said...

I think the final english syntax should be something like this:

switch X on 
   case a then 
	?1 
   case b,c,d then -- since we have multiple cases here, the 'then' is necessary 
   	?2 
   case else 
  	?3 
end switch 

Let me change formating of your example:

switch X on case -- two keywords in series, 'on' is new pure marker "just for BEu" 
         a  
         then ?  -- two keywords in series, 'then' is standard keyword in "if...end if" 
         1 
         case b,c,d -- "since we have multiple cases here, the 'then' is necessary"  
         then ?     -- two keywords in series, 'then' is standard keyword. 
         2          -- case b,c,d ?2 is good for parser 
         case else ? -- three keywords in series. 'case' is marker for else or what??? 
         3 
end switch 

If you read my previous posts on this subject, there are some suggestions from BEu side to English syntax.
And Russian version of 'then' keyword, 'to', is good in "if...end if" construct only. It probably will require new keywords for using in other constructs.

switch_on X   
    case a ?1  
    case b ?2  
    else   ?3  
end switch_on 
 
perekluchatt_po X      -- literal translation - from railway, electric circuits etc areas 
           kogda a ?1  -- 'when', literal translation - v_sluchae 
           kogda b ?2  -- 'when', maybe, just 'if' is good here???  
           inache  ?3  -- literal translation 
stop perekluchatt_po 

The new example above looks good for BEu. Without 'switch_' part, it looks more compactly.

jimcbrown said...
kinz said...

But do you use this 'on' somewhere else?
If it means direction of some other switching or such, it will be good idea too.

'on' would be a new keyword, so for now it would not be used anywhere else. Once 4.0 beta is released (at most 1 or 2 weeks from now), the earliest a new usage of 'on' could be introduced would be for EU 4.1

I'm not sure about that 'switch ... on' for BEu anymore, sorry.

jimcbrown said...

However, in english 'on' has a meaning of on/off that is similar to with/without or have/not have, as well as a meaning of allow/not allow. I think 'on' has more meanings in english than 'do' does.

I see, 'on' has 2 pages and 'do' has 2 pages too in my Muller. But 'on' is better for 'switch' thanks to direction, on/off, placement and other suitable meanings.
For Russian-English translation with/without, turn on/off seems to be better than switch on/off - switch can change direction.

So, let's think, guys...
Code of BEu, saved in English mode, seems to work on 4.0, I'll try it later on.
My vegetable garden waits me already, sorry. smile

Regards,
Igor Kachan
kinz@peterlink.ru

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

Search



Quick Links

User menu

Not signed in.

Misc Menu