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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!212.27.60.9.MISMATCH!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: S-expression I/O in Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <13b07f2c-2f35-43e0-83c5-1b572c65d323@y11g2000yqm.googlegroups.com> <13tpf7ya3evig$.h05p3x08059s$.dlg@40tude.net> <1omt2srxtpsga$.c3hbxthzo6cf.dlg@40tude.net> <1e4cch2df5uyb.18brqdd16dhv8.dlg@40tude.net> <14y70ke8am9qw$.2csc9eflvigg.dlg@40tude.net> <4c601b5c$0$7665$9b4e6d93@newsspool1.arcor-online.net> <9czktq4ntzq7.fhbsnocx0x4w$.dlg@40tude.net> <4c6078f9$0$12500$426a74cc@news.free.fr> <4c6132d2$0$8378$426a74cc@news.free.fr> <4c61dafd$0$14549$426a74cc@news.free.fr> Date: Wed, 11 Aug 2010 16:10:28 +0200 Message-ID: <4oebq9a8m8et$.gvv6eyo3umfh$.dlg@40tude.net> NNTP-Posting-Date: 11 Aug 2010 16:10:26 CEST NNTP-Posting-Host: 39e12290.newsspool2.arcor-online.net X-Trace: DXC=dTIJ0YJZ5[XFm0Y?OE@2^XA9EHlD;3YcR4Fo<]lROoRQ8kF On Wed, 11 Aug 2010 01:04:29 +0200, _FrnchFrgg_ wrote: > Le 10/08/2010 13:19, Dmitry A. Kazakov a �crit : >> On Tue, 10 Aug 2010 13:06:58 +0200, _FrnchFrgg_ wrote: > >>> Unification and pattern matching is independent of type inference. >> >> Did you mean the standard meaning of pattern matching instead of Standard >> ML's Volap�k? > > I meant pattern matching as a ML construct, which is in fact structural > unification. It can be done even without type inference, and only needs > some kind of polymorphism; essentially you have an object and an > expression made of (possibly nested) constructors, with leaves being > either constants or variables, and the unification engine answers > > a) if the object could be obtained by the sequence of constructors, or not > b) if yes, the content the variables would have had so that the sequence > of constructors would produce the object. > > For convenience, you often have a list of expressions, and the engine > executes the code of the first which fits the object. This translated into Ada terms, looks like an automated generation of literals/aggregates. There is one step required for Ada, i.e. interpretation of a text as code, since Ada is a compiled language. Main objection to all this is that it is hard-coded and involves the object's structure (not nominal). Ada has similar mechanism, also hard-coded and also structural. One generates S'Input and S'Output attributes for stream I/O of built-in container types (arrays and records). Another generates record and array aggregates. I don't like this either. I would like to see a more general mechanism that would allow user-defined recursive non-generic implementations. Because beyond literals and stream I/O there is an infinite number of cases where this pattern apply. And secondly it should work for user-defined opaque container types. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de