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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-19 13:23:58 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!iad-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!bpr.best.vwh.net!bpr Newsgroups: comp.lang.ada From: Brian Rogoff Subject: Re: status of Ada STL? In-Reply-To: Message-ID: References: <3d0ce154_5@news.bluewin.ch> <3D0D4274.6C5E02F9@acm.org> <4519e058.0206170753.599fd771@posting.google.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Wed, 19 Jun 2002 20:23:55 +0000 NNTP-Posting-Host: 192.220.65.223 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 1024518000 192.220.65.223 (Wed, 19 Jun 2002 20:20:00 GMT) NNTP-Posting-Date: Wed, 19 Jun 2002 20:20:00 GMT Organization: Verio Xref: archiver1.google.com comp.lang.ada:26434 Date: 2002-06-19T20:23:55+00:00 List-Id: On Wed, 19 Jun 2002, Robert A Duff wrote: > Brian Rogoff writes: > > I'll put together some examples, and post them under a more relevant > > subject line. > > Excellent. One thing I don't like about the pattern matching of ML and > the like, and that I *do* like about Ada's case statement is the full > coverage rules. I think a huge benefit of Ada is that you can write a > case statement without an "others", and you get a set of mutually > exclusive choices, and the compiler lets you know when you need to add > more (e.g. because you added an enumeration literal to a type). > (Too bad case statements are so restrictive.) Not sure I get you here. bpr@granite[bpr]$ ledit ocaml Objective Caml version 3.04 # type foo = Foo | Bar | Baz;; type foo = Foo | Bar | Baz # let f = function Foo -> "foo" | Bar -> "bar";; Warning: this pattern-matching is not exhaustive. Here is an example of a value that is not matched: Baz val f : foo -> string = #let f1 = function Foo -> "foo" | _ -> "Non foo";; val f1 : foo -> string = Isn't that the behavior you want? > The pattern matching features I've seen are more like "elsif" chains. They are far more powerful than elsif chains, since they do matching and binding. They're certainly a feature for programming in the small, but they have the IMO wonderful property of being readable and very succinct. > > Are you preparing a paper on it? > > Not yet -- just tossing ideas around. Hey, toss them around here too! -- Brian