<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:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
/* 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.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
{mso-style-priority:1;
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
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.font
{mso-style-name:font;}
span.size
{mso-style-name:size;}
span.E-MailFormatvorlage22
{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;}
/* List Definitions */
@list l0
{mso-list-id:360133594;
mso-list-type:hybrid;
mso-list-template-ids:-24618362 -1823722352 134676483 134676485 134676481 134676483 134676485 134676481 134676483 134676485;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:Calibri;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></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'>We can certainly debate heavily whether there is really a big aesthetical difference:<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'>. . . . . . . . . . . <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>IF x=A THEN<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> (* statements *)<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'>ELSIF x=B THEN<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> (* statements *)<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'>ELSIF x=C THEN<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> (* statements *)<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'>END;<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'>CASE x OF<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> A:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> (* statements *)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>| B:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> (* statements *)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>| C:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> (* statements *)<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'>. . . . . . <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'>How often did you use CASE in the past?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>When you want constant runtime, you could write something like.<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'>VAR Statements: ARRAY 10 OF PROCEDURE;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> Statements[x];<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 style='font-size:12.0pt;color:black'>Von: </span></b><span style='font-size:12.0pt;color:black'>Oberon <oberon-bounces@lists.inf.ethz.ch> im Auftrag von Diego Sardina <dsar@eml.cc><br><b>Antworten an: </b>ETH Oberon and related systems <oberon@lists.inf.ethz.ch><br><b>Datum: </b>Donnerstag, 15. Februar 2018 um 17:59<br><b>An: </b><oberon@lists.inf.ethz.ch><br><b>Betreff: </b>Re: [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">On Thu, Feb 15, 2018, at 4:12 PM, Jörg wrote:<o:p></o:p></a></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US> </span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US>If you write something like this</span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US> CASE idx OF</span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US> 0: idx := idx + 42</span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US> | 2000: idx := idx * 2</span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US> ELSE</span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US> END</span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US>and the compiler would implement it with a table, you have 1999 useless entries.</span></span><o:p></o:p></span></p></div></blockquote><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><o:p> </o:p></span></p></div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><span style='font-size:10.5pt;color:#1F1F1F;letter-spacing:.1pt'>In the past Pascal and Modula-2 compilers always limited case labels to 127 or 255, these two limits<o:p></o:p></span></span></p><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'><span style='font-size:10.5pt;color:#1F1F1F;letter-spacing:.1pt'>are also reasonable today and the entries' loss is very negligible.<o:p></o:p></span></span></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'><o:p> </o:p></span></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=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</span></span><o:p></o:p></span></p><p style='margin:0cm;margin-bottom:.0001pt'><span style='mso-bookmark:_MailOriginalBody'><span class=size><span lang=EN-US> </span></span><o:p></o:p></span></p></div></blockquote><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'>In "An Oberon Compiler for the ARM Processor", he wrote: The scanner is one of the few routines where a case statement is highly valuable.<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'>I agree with that not only for the constant time of the jump table but for the aesthetic, it is a nightmare how it was coded in current PO2013 :-)<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'>--<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='mso-bookmark:_MailOriginalBody'>Diego Sardina<o:p></o:p></span></p></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>