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,6689542a60dbcc55 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!feeder.erje.net!newsfeed.straub-nv.de!news.buerger.net!LF.net!news.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: Discriminated records are not the most efficient, but ... Date: Mon, 23 Aug 2010 07:43:26 +0200 Message-ID: <87d3t9riip.fsf@mid.deneb.enyo.de> References: <874oemcr37.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: idssi.enyo.de 1282542206 9899 172.17.135.6 (23 Aug 2010 05:43:26 GMT) X-Complaints-To: news@enyo.de Cancel-Lock: sha1:/7xSVSFWCDnxHD2hQQ3aaUdcaXI= Xref: g2news1.google.com comp.lang.ada:13645 Date: 2010-08-23T07:43:26+02:00 List-Id: * Yannick Duchêne (Hibou57): > In ML : a functor has the following signature: “structure -> > structure”. So at first sight, this may seems ML functors cannot model > Ada packages. But as a functor takes a structure to return a > structure, this is exactly the same as with an Ada generic > instantiation. As in ML a functor cannot create a structure signature > and can only create a structure matching a structure signature, > finally, application of an ML functor exactly match the process of > instantiating an Ada generic. Except that ML favors structural typing, and Ada is focused strongly on nominal typing. > Conclusion: the Ada package system can be properly modeled with ML. Standard ML doesn't support functors nested in structures and higher-order functors, but both are a common extension. > Definition of an ML signature = Ada specification of a package or > generic package (formal part excluded) No, these two aren't equivalent. You cannot apply a specification to a package to get a new package (with a restricted interface, as some sort of type conversion). In Standard ML, you can.