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.66.88.200 with SMTP id bi8mr654106pab.27.1353024088741; Thu, 15 Nov 2012 16:01:28 -0800 (PST) Path: s9ni18200pbb.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: Thu, 15 Nov 2012 18:01:28 -0600 Date: Thu, 15 Nov 2012 19:01:28 -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> In-Reply-To: Message-ID: X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-QXZ0bMunqhJUfi77zsME0mEv/HeLOZCG76+JRw33E+IiyBycVbzPDPGJxEJEI4r49KXgK1nsAO4tCuS!dxFkBOBHZ2e3VnlrdozwJ7mADutiQgM7iyC9fNkQtB6JVT13yqMO/lpirla4xVk= 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: 3159 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-11-15T19:01:28-05:00 List-Id: 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. > 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. I guess I'm not understanding what you mean here. > 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. If you have higher order functions then you will have a way to write function types. For example, in Scala: def filter(someList: List[Int], predicate: Int => Boolean) = ... This defines a function 'filter' that takes a list of integers and a function from Int to Boolean. The notation 'Int => Boolean' is a function type. And yes, you can write types like (Int => Boolean) => String for functions taking a (function from Int to Boolean) and returning String. It's no big deal. After all you can use access to access types in Ada. You can use records containing records. If you want names for the intermediate types, create names for them: type PredicateType = Int => Boolean type PredicateProcessor = PredicateType => String Peter