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.4 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FORGED_MUA_MOZILLA,FREEMAIL_FROM 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.68.197.201 with SMTP id iw9mr2482977pbc.6.1353254324305; Sun, 18 Nov 2012 07:58:44 -0800 (PST) Path: s9ni23458pbb.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 18 Nov 2012 09:58:43 -0600 Date: Sun, 18 Nov 2012 10:58:43 -0500 From: "Peter C. Chapin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada202X : Adding functors References: <0114d327-9f9f-4ad2-9281-56331d11a90c@googlegroups.com> <15w6caje3zsh$.t5nqtwoa77x5$.dlg@40tude.net> <1nns2z6uw5q7m.1vv6s1jevxoqb.dlg@40tude.net> <1a6o8r3qx00mt.q6xayy8lqwr4$.dlg@40tude.net> In-Reply-To: <1a6o8r3qx00mt.q6xayy8lqwr4$.dlg@40tude.net> Message-ID: X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-e2NtIv7pfPHUnfW8RWpSESuN1jQaAstxdT8Z8mtFFiapYZmOzNPz+Rxz1DULqyDPLntuKS5uN+GWN1P!hASTR8vlBscUicw02dhOvkq1KtiD/LUp36BS1U+Lqlf5I9XUT6TJ9HDD/aq3eFY= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3566 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-11-18T10:58:43-05:00 List-Id: On 11/16/2012 12:44 PM, Dmitry A. Kazakov wrote: >> class MyClass extends (Int => Boolean) => String { >> // ... >> } > > And the semantics of? In Scala, anyway, there is a "magic" method apply that is used to define what happens when an object is applied to arguments. Since function types are abstract in Scala the compiler will require the programmer to override apply() to define what MyClass objects do when they are used as functions. > Considering this: > > type T is tagged ... > procedure Operation (X : T); > > procedure Operation_1 (X : T) is new Operation (X : T) with ...; > > would mean what? I'm not sure. Are you trying to define a new type similar to type My_Integer is new Integer; Or are you talking about dynamically creating function objects? On the other hand based on your comments it sounds like you might be talking about adding "methods" to existing "classes" (using non-Ada terminology). Or maybe you are speculating about the behavior of function types if they were also tagged types themselves. I can't tell from your presentation what you are talking about. Anyway, it could well be the case that adding first class functions to Ada would be a bad idea due to unfavorable interactions with existing features. Perhaps this is what your examples are illustrating. But... that doesn't mean that first class functions are "weakly typed" in general. I believe that was your original assertion and that's what I'm taking exception to. It might be interesting to note that, again in Scala at least, methods and functions are treated differently and methods are not really first class (although functions are). The compiler will implicitly wrap a method in a closure so it can be treated like a function but doing so needs a specific object to resolve the method's internal 'this' reference. If one wanted to get serious about adding first class functions to Ada perhaps a similar path could be followed to make it work sensibly. Peter