Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id ABBA2200D5C for ; Fri, 15 Dec 2017 08:02:16 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AA472160C14; Fri, 15 Dec 2017 07:02:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EFFC6160C06 for ; Fri, 15 Dec 2017 08:02:15 +0100 (CET) Received: (qmail 68535 invoked by uid 500); 15 Dec 2017 07:02:14 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 68524 invoked by uid 99); 15 Dec 2017 07:02:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2017 07:02:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 04B3E180780 for ; Fri, 15 Dec 2017 07:02:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.001 X-Spam-Level: X-Spam-Status: No, score=-3.001 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-2.8, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id SPxJ6SMtoXXa for ; Fri, 15 Dec 2017 07:02:12 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 8A01E5F33D for ; Fri, 15 Dec 2017 07:02:11 +0000 (UTC) Received: from [192.168.1.4] ([89.12.104.176]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M936L-1eJwZS2yYH-00CQKF for ; Fri, 15 Dec 2017 08:02:03 +0100 Subject: Re: Extension method upgrades To: dev@groovy.apache.org References: <1513202990422-0.post@n5.nabble.com> <1513314646284-0.post@n5.nabble.com> From: Jochen Theodorou Message-ID: <335042eb-0a70-c99e-b898-ea36f004f9bd@gmx.org> Date: Fri, 15 Dec 2017 08:02:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <1513314646284-0.post@n5.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:CRpFHThcM5mPKyKbMDHHuEmXMNBTNYovINdCjUyLqRKX+RWMU7d fbNl8dGRoCEa5CSE2OqLkQRhhTyvlso0sRDckyLGoSfbRfpQzciVtNtrkj2mCMUsFqt+weQ zE6t38/CKQX67ymFD5cAn2HHNdIFHWGxYUzxRO1vwcGoNAh91vLepUR8g0EE6NG7vSpWFk3 JDyBfLLIRZsT9jqRI1oww== X-UI-Out-Filterresults: notjunk:1;V01:K0:5dM214Yfm5E=:8mTh6o8cGGbJrcZl44gCS7 SkZx5s+eZ611MwfUEmFEeGH957I6zdBJ16M6LSHFu3lEsP0qzPVL0uTagWIZ+DhAlWnDnLyz1 Y62oLj9XQBoS7vcK09Jj3zTBkqLm1dI8Vgk96jXMyhBKZySVdFPi85lpPmzgQHAG8uPTnxJZi Ywg6rs9rU9hXT50hfNVIpXy/1TXt1AAstjTI+7QC/UtMQN8BzG5ebvz945KHUfCyXxr06hYj/ Pz+7pIsVORwqfYLQprKw+XJq0eO5kyH8EeWSXKnidhcmUDgQeZ/7oX+pFPLoLM/qD34KeheZR QUeG+V0KL5H5vW3IG876PYWVk59tkGz86Kb01+gYThKuR5KhKdN7k+rgNL2JmjQdOiUY5EUri j9NxADOAdUQXi7ARd66oLpU9UdzDJDPLY28bmBeOiyna1wrVRP9dVA9/cNqksDAKkdXPGfjpc PZXWy9UVPKPT13WXFwSSo5tm+v5phqSKZbecOmSQ4SnqXw7mFbBtCArgIknRm/9xATxQiSVtM tZ7F6w405GhbNJZJIwKgqwcakPT9K1mdFs4gMhETsTeFAXk9FndUvk/npc+YzaNRzhtHC+v7H sAE/z7z2+drGPgxomwqWO1m4Tr05x0cDgw0NhkxzbzVOlIa/4hP4Cbdvv6O9xwyqhAnXqsVye UYkt4cgskZ2+qagIIBYAsBsgWIm3gkbdr9kCw1Oe5d3wiWnd500yJo9EpU5tSO58B/VxJ0wrm QNOGL9n1GCAZSJapPQ6U7HIrHx1yOo2VoOcDh4jLENCWCUQY6pIhQR0lNla9GIqvE7HZdUAjA FaHjR+R6uGaSgZj14UwF4zRn/BARvYLylTHUd3cbqXiN/Jqt+0= archived-at: Fri, 15 Dec 2017 07:02:16 -0000 On 15.12.2017 06:10, Nathan Harvey wrote: > I think your first step - "define a file that contains extension functions" - > is slightly wrong. In Kotlin, you can place extension methods anywhere, they > do not have to be confined to a single file (or worse, like Groovy, in a > totally different dependency). The syntax I discussed is what enables them > to do this. I am aware of that you can define them anywhere. But frankly, I find that pretty messy. I mean defining quasi global extension methods randomly all over the place... does sound like maintenance hell to me. Probably best to declare them inline as well, then you will never ever be able to find them again, if they are from a library. > I'm not sure of the troubles this introduces in a dynamic context, but it > seems your assumptions about the compiler reading in all classes then > parsing extension methods first is likely the correct way to do it. The trouble for the dynamic mode is, that this won`t work there. > Maybe > someone with more knowledge can chime in. I do think multiple conflicting > extension methods should error in the exact same way that normal methods > error. Well... if there are completely bound at compile time,then the compiler has to do that. In Java you also have the fallback with the JVM checking that for the class... Obviously that does not work for an outside of the class construct the JVM has no idea of. > I think allowing extensions or "import extensions" would be a step in the > right direction. The main technical hurdle seems to be allowing the methods > to be declared within the same project. From there it is just syntax > differences. We are talking about the static compiler only, right? Because normal Groovy should actually be able to handle this by not caring. What I mean is that till runtime dynamic Groovy does barely do any method resolution and none that should influence extension methods. So if they are there or not is of no concern during compilation for dynamic Groovy. And if the descriptor is then on the classpath it should be able to pickup the extension methods at runtime. So I think this should work for normal Groovy and only static Groovy should have trouble here. Are weon the same page? bye Jochen