<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:ArialMT;
panose-1:2 11 6 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=DE-CH link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>You’re right. A time ago, I detected this as well.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>I guess it’s on purpose.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>The compiler doesn’t even implement the numeric case. Only CASE for type extension is implemented; NW neglected WITH.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>NW writes:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"ArialMT",serif'>The case statement performs the same function as the if statement. However, it is intended to use a different technique of implementation, namely a single, indexed branch instead of a cascade of conditional branches. This is sensible only if the cases are distinguished by a (mostly) contiguous range of label values. </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>If you write something like this<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> CASE idx OF<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> 0: idx := idx + 42<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> | 2000: idx := idx * 2<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> ELSE<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> END<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>and the compiler would implement it with a table, you have 1999 useless entries.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>NW seems to have changed his mind on CASE. The compiler itself rarely uses CASE these days. eg ORS.Get() formerly THE case for CASE uses cascaded IFs<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>br<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Jörg<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:12.0pt;color:black'>Von: </span></b><span lang=EN-US style='font-size:12.0pt;color:black'>Oberon <oberon-bounces@lists.inf.ethz.ch> im Auftrag von Josef Templ <josef.templ@gmail.com><br><b>Antworten an: </b>ETH Oberon a</span><span style='font-size:12.0pt;color:black'>nd related systems <oberon@lists.inf.ethz.ch><br><b>Datum: </b>Donnerstag, 15. Februar 2018 um 15:28<br><b>An: </b><oberon@lists.inf.ethz.ch><br><b>Betreff: </b>[Oberon] CASE without ELSE<o:p></o:p></span></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><a name="_MailOriginalBody">Hi everybody,<o:p></o:p></a></p><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>recently I noticed that there is no ELSE clause in the CASE statement of the latest Oberon language version.<o:p></o:p></span></p><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>Has this been removed intentionally or accidentally? Or is there something new instead of it?<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>If it has been removed intentionally:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>Is there a significant simplification in the compiler or a speedup at runtime?<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>On the other side, it puts some burden onto the programmer to work around it.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>As an example: I tried to implement a simple command interpreter that reads a character<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>from a serial line (connected to a keyboard) and executes a related procedure in an embedded target.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>The natural language construct, I thought, would be a CASE for that kind of problem.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>Pressing an invalid key could be ignored easily by the ELSE clause of the CASE.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>- Josef<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><o:p> </o:p></span></p></div></div></div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon </span><o:p></o:p></p></div></body></html>