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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Formal and informal type systems? Date: 28 Sep 2004 19:47:40 -0400 Organization: Cuivre, Argent, Or Message-ID: References: <49dc98cf.0408110556.18ae7df@posting.google.com> <413e2fbd$0$30586$626a14ce@news.free.fr> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1096415276 8679 212.85.156.195 (28 Sep 2004 23:47:56 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 28 Sep 2004 23:47:56 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:4345 Date: 2004-09-28T19:47:40-04:00 Mark Lorenzen writes: > Consider the following data type and it's two value constructors: > > type Optional_Integer (Defined : Boolean) is > record > case Defined is > when True => Value : Integer; > when False => null; > end case; > end record; > > I think it would be quite nice to have the possibility to define the > following subprograms: > > procedure Do_Something (I : Optional_Integer(Defined => False)) is > begin > null; > end Do_Something; > > procedure Do_Something (I : Optional_Integer(Defined => True, Value)) is > begin > Do_Something_More(Value); > end Do_Something; > > The pattern matching could also be extended to case statements such as: > > procedure Do_Something (I : Optional_Integer) is > begin > case I is > when Optional_Integer'(Defined => False) => null; > when Optional_Integer'(Defined => True, Value) => > Do_Something_More(Value); > end case; > end Do_Something; I'm sorry, but I have no idea what semantics you intend this new syntax to represent. I don't know ML, so I can't guess. Please treat this as a chance to entice me to learn more about ML. How, exactly, is your Do_Something different from: procedure Do_This (I : Integer) is begin case I is when False => null; when True => Do_Something_More(Value); end case; end Do_Something; In particular, where is "Value" coming from? It appears to be a global variable. You mention "pattern matching", but I have no clue what dataspace you are matching against. -- -- Stephe