From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!news.buerger.net!uucp.gnuu.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 02 Mar 2011 11:24:19 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.14) Gecko/20110123 Thunderbird/3.1.8 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <4d4c232a$0$28967$882e7ee2@usenet-news.net> <4D4D6506.50909@obry.net> <4d50095f$0$22393$882e7ee2@usenet-news.net> <4d6d56c4$0$11509$882e7ee2@usenet-news.net> <4D6D6A90.2090108@obry.net> <4d6d6e60$0$11509$882e7ee2@usenet-news.net> <4D6E0BA5.9080301@obry.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d6e1ad4$0$6986$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Mar 2011 11:24:20 CET NNTP-Posting-Host: 426263f0.newsspool4.arcor-online.net X-Trace: DXC=oBYlVRg5a63lIh70@ejV8D0cP2O3d086oEO0n7RC@m1 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:18689 Date: 2011-03-02T11:24:20+01:00 List-Id: On 3/2/11 10:45 AM, Nasser M. Abbasi wrote: > ---------------------------- > swith(clientID){ > case "eStore": > callEStore(); > break; > case "Retail": > calRetail(); > break; > case "CSR": > callCSR(); > break; > default: > invalidClient(); > } > ----------------------- > > It seems like it might be a convenient feature? The feature is present in Eiffel and C#. The syntax looks nicely clean, compared to repeated ifelse. Is it healthy in practice? If a convenience, and welcome as such, what kinds of programs will the feature make more likely when in the hands of programmers? With Java 5 enumeration types, you can already link strings and methods to enumeration literals. And then still use enums, not strings, for making distinctions. If Java 5 were Ada, a Java programmer could then switch on an enum and be sure that all cases are covered specifically (no "others" or "default"). This cannot be achieved with an untyped selection of strings (i.e. not some type's set of strings), since no case coverage is possible. You might also end up with two kinds of string literals in your Java program, but not with two types, since there is only one for string literals: (1) Strings that can be "internationalized" and (2) strings that can't because they control program logic in some switch statement. Or can you switch natural languages while the Java program is running and still assume that the switch {} will be working as it should? Can the translation of the switch still be efficient? Granted, similar issues can affect ifelse, e.g. when a translation produces the same word W for two different words W1 and W2 of the original language. Conclusion: controlling program flow by inspecting string values creates maintenance effort and program translation issues caused by the absence of distinguished types.