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 B4A22200B28 for ; Sun, 26 Jun 2016 11:18:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B32C9160A5C; Sun, 26 Jun 2016 09:18:20 +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 D3E56160A28 for ; Sun, 26 Jun 2016 11:18:19 +0200 (CEST) Received: (qmail 2723 invoked by uid 500); 26 Jun 2016 09:18:19 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 2713 invoked by uid 99); 26 Jun 2016 09:18:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Jun 2016 09:18:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 813AEC0026 for ; Sun, 26 Jun 2016 09:18:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-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 mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id PLqABKvo8ZRR for ; Sun, 26 Jun 2016 09:18:16 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 474FA5F2F0 for ; Sun, 26 Jun 2016 09:18:16 +0000 (UTC) Received: from [192.168.1.6] ([89.12.108.202]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MaF8e-1axMOe2mhk-00JrPv for ; Sun, 26 Jun 2016 11:18:08 +0200 Subject: Re: Is it possible to enable CompileStatic for an entire project To: users@groovy.apache.org References: <576931E8.7000606@gmail.com> <5C676E6359909E478C7B811BDB48CA354A6318@CWWAPP478.windstream.com> <57696D31.4080604@gmail.com> <5C676E6359909E478C7B811BDB48CA354A6703@CWWAPP478.windstream.com> <5769B22E.8070907@gmail.com> <5C676E6359909E478C7B811BDB48CA354A6C16@CWWAPP478.windstream.com> <576AC312.5040302@gmail.com> <576ACEB3.9000302@gmx.org> <576D5BE2.8000301@gmail.com> <576D9E56.9060807@gmx.org> <576F801B.60801@gmail.com> From: Jochen Theodorou Message-ID: <576F9DCD.8020506@gmx.org> Date: Sun, 26 Jun 2016 11:18:05 +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: <576F801B.60801@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:GQ3JdzX14PsGrHNwLdkfsg453saC9J+qDltmWMZm3xB++YhAQpp xkz2lV9HcnjLjC2XNcfMPUj2SETP9/JzERmixJnkhlKuQIt10xVIDBfvyuzcWzTwvJ+d8PV GVpUdsx3KxvXd9vdWKdpkYbUjRnnq/U2lL20ztRgmf+gKEhm/eV7TRjf8deQn/1RCVQuuo1 Rff2TfDvc9U3Y7oWqWsAw== X-UI-Out-Filterresults: notjunk:1;V01:K0:/XTUlI/wKtA=:o2/S5f69Xm9sB3nYYj2a3T cLxSbIeQAME/20YHftDvB6Oj2aRev3xIMc8PdziTscuaG0CAxERMVDgqwl8lWsyGHVCUXEOso cTiN55LUJx7u/xQSGCzDPN/0gJbWGnr7azaB1f1SQhq2yGPp1BUnBku0S5aOjd7TVtdP4YveI GqNkIBSIl1MuV7/ijR4cQkyo8yB1U5ah/KT5D74hZvRSn2sXW/YPjFsU6hM/iqAOAD3O7ztUd CkhUCSf6gM5fLukVfiQ0vNCCkIfqskBDsUb7idJ8My0NH8Gwk/akslfvvGGcRWndkYW6pigNF +7X4cQp2TxOyBMnsUOjCXwgkjDvCAiyNUz315ElPVj4h1ok4nXl2KcqTzCbOhiBYDdphExS6g ZPCdTLQm4RN9ncyVnnZbjlNw0zOKLZnpZ2ri2NC4l6u67BzL1Sc7okqIJTavi8pP38HuTUb42 elIcEerGBpUOfVNbfosPCxweJl5UBSUOPZLmrHXu2FKEMNw1WE3YsmJqiqiwywmBhwgWW5zL1 OkuyPCQ6IvWmkjcWfQ+NGvgeIZHiDeq1V8wqwyJggPMP+hrj5suoXvR63WWJOE4W8L6W+agWH MS0NMKcjYc8VlBLiYCVzmJmlfssvFME/jpYR3OrGay1jUUVH/K1lDXyAULAVTY08PY0pHol6J oies/COmZaPMOnvuyAKbaE9H+hJc+Of77BAtknuzK2Rz93Gws6yvl6qX3beHc4NXkaGPSHa3u tR1i5JB/eQ3ZFut4Nk+F+N+L7iAIpKr4QFdLcbacrCDvELtpu/ezNAiHN1zCMHuTSEUEZwoxy MD5720m archived-at: Sun, 26 Jun 2016 09:18:20 -0000 On 26.06.2016 09:11, Mr Andersson wrote: > > > On 06/24/2016 10:55 PM, Jochen Theodorou wrote: >> On 24.06.2016 18:12, Mr Andersson wrote: >> [...] >>>> static Groovy is on par most of the time, dynamic Groovy depends, but >>>> I think it is more in the range of being 2.5 times java (100ms runtime >>>> becomes 250ms). I think that is close enough.... and there is still >>>> some potential >>> >>> But a Java fork would be almost 1:1, if all it generated was Java like >>> code. >> >> Java like code means to do what Java does. Basically you want a >> language that includes Java and does things different only in parts, >> which are not in Java... That means loosing ==, that means loosing our >> array access logic, that means loosing double dispatch of course.. >> doing builders will become difficult... unless you want to do them >> like Kotlin. Runtime meta programming basically impossible >> >>> I think the performance issues is the invokeDynamic calls that >>> groovy does internally, and they might not necessarily be needed. >> >> there not that many of those, really. >> >> [...] >>> However, any editor could in principle, and in theory tell you on any >>> call, what exceptions can be thrown and what kind of exceptions you >>> could choose to handle. Ofcourse that would result in many exceptions >>> often but the need to declare them on each method is largely syntatical >>> and ugly. >> >> think of a public method and an unknown subclass overriding that >> method. How can your editor know, that your library method can only >> throw the exceptions you use in your code and no other? It cannot, >> unless you make the method final, or say you don´t do libraries ;) > > Yes, I also mentioned that case. But since that abstract method either > has an throws exception declaration on it for specifically stating what > kind of exception can be thrown, to notify the editor. One should still > however expect other types of exceptions. The thing is that currently, > even if an abstract method does not directly state it throws an > exception type, it can still throw a new RuntimeException(new > IOException()) so why force the wrapping in the first place? wrapping is irritating me. The JVM does not really know a difference between a checked and a unchecked exception. Thus on the JVM level you really do not need to wrap anything.... and in Groovy we do not do that, if we can avoid it. In fact I removed lots of wrapped exceptions over the years, that have been only required to transport them through the runtime for the satisfaction of the java compiler. > Why force an implementor to either handle an exception type when most of > the time it doesn't even make sense to do so. If an implementor to a no > throw exception abstract method, say has to open a file and read it, and > then return a String, what should that implementor really do to handle > the IOException? First it happens so rarely that it doesn't make sense > to handle it, then even if you do handle it, you can only log it. The > abstract method caller still excepts a response, and you can not abort > the caller, unless you throw a RuntimeException and hope that he manages > it, or return null. Why trycatch(Runtime) when you could just as well > trycatch(Throwable) in this case. You would not need a getCause call to > figure out if it's wrapped or how many times it has been wrapped. You > could also without wrapping trycatch(IOException) directly. and then your project is also checked with sonar and it wants to force you to not just ignore the exception as well.. yeah, I know that pain > But to be honest, the entire notion of exceptions is kind of broken. An > IOException is not unique other than by at best it's message, and if one > decides to bubble an IOException, at some point you will no longer know > what actually was the root reason if in the call hierarchy as multiple > places can throw an IOException for various reasons. but the question is how to make it better. Just making all checked exception unchecked won´t solve this. I know of 3 ways of error handling... (a) exceptions, like in Java, Python and many other languages (b) error object or status code as return value, like C for example (c) using multiple return to transport status code (or error object) as well as normal return value.. like Go I don´t like option b much, but in all cases you need to adapt the control flow of your code to the error handling in some way or other. bye Jochen