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 0A1F1200B99 for ; Wed, 5 Oct 2016 19:33:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 08A84160ADE; Wed, 5 Oct 2016 17:33:09 +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 4D8FF160AC9 for ; Wed, 5 Oct 2016 19:33:08 +0200 (CEST) Received: (qmail 80430 invoked by uid 500); 5 Oct 2016 17:33:07 -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 80420 invoked by uid 99); 5 Oct 2016 17:33:07 -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; Wed, 05 Oct 2016 17:33:07 +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 A869518050F for ; Wed, 5 Oct 2016 17:33:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.702 X-Spam-Level: X-Spam-Status: No, score=-0.702 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id uTcN_YoDBpAr for ; Wed, 5 Oct 2016 17:33:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 76A155F231 for ; Wed, 5 Oct 2016 17:33:04 +0000 (UTC) Received: from [192.168.10.9] ([89.12.106.58]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0M8ZtH-1ax6kO0k4Z-00wAKU for ; Wed, 05 Oct 2016 19:33:03 +0200 Subject: Re: Proposal: Statically compileable builders To: dev@groovy.apache.org References: <3ecaeb92-df79-2240-5af9-a13b9011bb9c@gmx.org> <57F412A1.9020506@gmx.org> From: Jochen Theodorou Message-ID: <57F5394C.3090603@gmx.org> Date: Wed, 5 Oct 2016 19:33:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:RtiA6kSKkoDAaCunnmciIVs1nVjAnV5owwhXCMkh613TYcmcPle YdGaYwHbKrVYYosu45HexXU1Nejea+FiIJtyEAm1J2hpYiWg+Jbut6R1hzqj2mdIZk7DwXs YSoPKBUIRi81arIDzq3uXzDAmmyoJXy5t8hiDshYk7LImbIpatYrJAlV/8I5NSLyJDAOgMp W/36tbe9sYUNeG5N1Feww== X-UI-Out-Filterresults: notjunk:1;V01:K0:YWF9eZx6WDQ=:IOCYS2uXmKA68+Kjf/SgGA E4f/vFr1NjF2RmTia2ana8D5Ox7Fjn/CeFiwk/WNtw0f1N81+08Rv9qqRkn+LUfP0Y9DtyuTG UST8zxbZCJR4IzYW2soSgnP/jGZUTCwLlHnzQuCS7MwZmeNmPESBKH+CzB/A5Nnu8fvAq8DL5 af4sQwjQ5AnNqW4MavuDZ7jczoHRY3K+y+tuCA3kg3gM0gR1t18jBh4CJpPZyDCO6prmUU/le n6UceBnMr+wfwOBhor0gxIhd3QxG7tnkBEksnuc8I9J8HLFM4ol0aF4ww3CJKDpX/Y4fg+7tE Uuuu6TWtRvgBIrEphKiTZUmgG9Nj159tUhgJ7wOWITKIrNczlBDRgkE+bACjqjfWjGcNM+UDu XEypahkMO+Z7Rr/gG8hU8sY2PT3MP4iDFqc+J0xaWeFgyxOo+kdMyfH/RXIGmeMeBb2N49Lb3 u0ubpmIY32k4wWrlDOYEJM8ZaXjDRxCWwt/VQcYBCiS1JnO0XGje8qojr2vvvJLmETDGgwp9k WL9pNJTYIUyNIVRykiGDoGim0Wo+V4dWZEviCfr4/ztPPi0lAnNeuLaCDggyOaxGxBvVtMsyD z3lFfK0/rbvMfginbx3A/T2ZydsDbAwV+nu1MwhTdHax7T2w7I3LmDW+SKYU1kNLFkVtbYFuB R+p4nltxRlnu9NkJsnGSnsOY45KpC5pNokfqFHoVZ+mkosEpipdR+wOgAu4gQwbZZe2hTNlV3 QaDoe1XZgFsJVxoi6PHoVZKHpTpesKzhyooMVAlXmbNe9ADtpYXedQYcaAFOI4xGZxOx/Yvtl gIXcwts archived-at: Wed, 05 Oct 2016 17:33:09 -0000 On 05.10.2016 08:13, Graeme Rocher wrote: [...] > So again let's revisit the benefits of this change: > > 1) You can write classes annotated with @CompileStatic and use > builders without having to compromise the design of your code > 2) You can get type checking for non-builder methods if concrete types > are used in methodMissing (example "methodMissing(String, Closure)" > and type checking for properties if "propertyMissing" is not defined > 3) You will get better performance and no matter what we do to the > dynamic side that will stay the same > 4) Our goal should be that as much code as possible is compileable > with @CompileStatic and this change helps that I would appreciate to exclude (1) from the discussion for now. Third party bias and fears will not lead to a constructive discussion. Then for (2)... methodMissing(String, Closure) will not get you anywhere in terms of type checking. This is for methods "foo{...}" or "bar{...}", where bar and foo are the String. If you write foobar instead, there is nothing preventing compilation and failure at runtime. And it does not scale: The more methodMissing you have, the less likely there is the chance for a compilation error due to builder method argument. And I actually still fail to see how you want to use this with @DelegateTo(Map), unless all builder methods of that form will have these properties. (3) depends on the implementation. Your suggestion will not give the best performance, neither in the static, nor in the dynamic world. Which really makes it difficult for me to see the performance argument. You are right in that using something like categories will make performance degrade of course. And (4)... looks more like a result of (1) to me and will not help discussion.. Unless you say you only want a builder that will pass static compilation and donĀ“t care about real type checking and performance. In that case we can shorten this discussion a lot. bye Jochen