From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92676 invoked by alias); 16 Mar 2017 22:57:44 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 92087 invoked by uid 89); 16 Mar 2017 22:57:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Mar 2017 22:57:41 +0000 Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1coeKy-0000tk-12; Thu, 16 Mar 2017 23:57:40 +0100 Received: from 76-9-84-127-rt-broadband-01.broadband.oakhurst.sti.net ([76.9.84.127] helo=localhost.localdomain) by mailfront11.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1coeKt-0001Fn-AK; Thu, 16 Mar 2017 23:57:35 +0100 Subject: Re: Are types checked statically? To: list+org.sourceware.kawa@io7m.com References: <20170316170239.2e6b55d0@copperhead.int.arc7.info> <20170316173830.59958bf8@copperhead.int.arc7.info> Cc: kawa@sourceware.org From: Per Bothner Message-ID: <8847c956-30b3-8cf5-f911-8502be64e6b6@bothner.com> Date: Thu, 16 Mar 2017 22:57:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170316173830.59958bf8@copperhead.int.arc7.info> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q1/txt/msg00081.txt.bz2 On 03/16/2017 10:38 AM, list+org.sourceware.kawa@io7m.com wrote: > On 2017-03-16T10:23:24 -0700 > Per Bothner wrote: >> Kawa currently doesn't have "function types" - the type of all >> functions is just 'procedure' without any specification of >> argument or result types. However, the following is on the wish-list: >> https://www.gnu.org/software/kawa/Ideas-and-tasks.html#Optimized-function-types-and-values-using-MethodHandles > > I'm not sure I understand this fully. I'm familiar with JVM internals, > including method handles, but the above is more an issue of efficiency > than of correctly checking the types of functions, isn't it? Unless I'm > mistaken, Kawa lambda expressions have the proper types and the types > are checked statically, right? They just may not have an efficient > underlying representation on the JVM. It's not just performance. A *specific* lambda expression has proper types, and if you call a *known* procedure it is type-checked. However, there is no way to say "the value of this variable is an unknown function that takes (T1 .. Tn) arguments and returns a Tr result". That is a major part of what the linked proposal does - in addition to enabling better code generation. It is possible to add procedure types, and only use them for type-checking, without optimizing the calling convention. -- --Per Bothner per@bothner.com http://per.bothner.com/