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,2078ce7aac45af5b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.248.34 with SMTP id yj2mr927845pbc.2.1353046201212; Thu, 15 Nov 2012 22:10:01 -0800 (PST) MIME-Version: 1.0 Path: s9ni19060pbb.0!nntp.google.com!news.glorb.com!newsfeed.straub-nv.de!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada202X : Adding functors Date: Fri, 16 Nov 2012 00:09:56 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <0114d327-9f9f-4ad2-9281-56331d11a90c@googlegroups.com> <15w6caje3zsh$.t5nqtwoa77x5$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1353046200 9400 69.95.181.76 (16 Nov 2012 06:10:00 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 16 Nov 2012 06:10:00 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Response Date: 2012-11-16T00:09:56-06:00 List-Id: "Peter C. Chapin" wrote in message news:WdGdnd-Z6-nFHzjN4p2dnAA@giganews.com... > On 11/15/2012 12:04 PM, Dmitry A. Kazakov wrote: > >>> Could you elaborate on what you mean here? There are statically typed >>> functional languages where functions are first class and that also have >>> a reasonable notion of type safety. >> >> I think they are actually weakly typed. > > In the functional language that I use the most (Scala) lambda terms are > statically typed and fully checked at compile time, just like any other > expression. There's more to a function contract than just the type-and-result-profile! To truly statically check such things, you also have to match the precondition, the postcondition, the exception contract, the global in/out usage, and so on. (Matching doesn't necessarily mean exact equivalence, of course, which makes it even harder.) For Ada 2012, we simply punted on these issues. But that makes access-to-subprogram (or any sort of lambda, which would be semantically similar to access-to-subprogram) fragile: you can get Assertion_Error from any access-to-subprogram value, and there isn't much you can do about it. One hopes that Ada 2020 will do better in this area, but I'm dubious that it can be done well for access-to-subprogram (and lambdas, and formal subprograms, all semantically similar). Complete reliance on dynamic contracts can be useful, but it certainly isn't my idea of strong types (that is, enforced at compile-time). Randy.