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,2078ce7aac45af5b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.86.39 with SMTP id m7mr286032paz.4.1352999089350; Thu, 15 Nov 2012 09:04:49 -0800 (PST) Path: 6ni83300pbd.1!nntp.google.com!news.glorb.com!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada202X : Adding functors Date: Thu, 15 Nov 2012 18:04:42 +0100 Organization: cbb software GmbH Message-ID: References: <0114d327-9f9f-4ad2-9281-56331d11a90c@googlegroups.com> <15w6caje3zsh$.t5nqtwoa77x5$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: pSb85Ij4EqcuHDcWtw64BQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-11-15T18:04:42+01:00 List-Id: On Thu, 15 Nov 2012 10:52:02 -0500, Peter C. Chapin wrote: > On 11/15/2012 05:11 AM, Dmitry A. Kazakov wrote: > >>> IMHO, lambda closures are better in every way than a 'functor', and I for >>> one would welcome their addition to Ada. >> >> I doubt that could be made compatible with static typing. Comparing >> advantages of both static typing is a clear winner. >> >> But it is of course an interesting question how much functions could be >> made first class citizens without loosing safety (and proper typing). > > 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. Nobody would admit that easily, I would not wonder if Forth people claimed it statically typed as well. (:-)) Anyway, the issue is that functions are intimately related to the types of their arguments and results as primitive operations. Non-first class functions are singletons which ensures 1-1 mapping between the operation and the argument/result type. First-class functions would break that correspondence. They could be seen as "free functions" regarding their arguments/result, of course. But, again, there are good reasons why all operations should be primitive and none free. Yes, Ada violates that rule and this is a problem already. It is also unclear what happens with the operations defined on functional objects. What will be the types of function functions (functionals)? It is an infinite recursion of higher-order functions to stop somewhere. Maybe somebody could sort that out, maybe not. In any case there are enough troubles without that. And I personally find functional decomposition bad. Georg already posted a quite disgusting example of how it could look like. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de