groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keegan Witt <keeganw...@gmail.com>
Subject Re: Changing the default to TypeChecked
Date Wed, 27 May 2015 16:49:11 GMT
Hi Steve,

   1. If you want type checking without static compilation, yes.
   2. @groovy.transform.CompileDynamic (despite its name, my understanding
   is it disables type checking, not static compilation).
   3. Yes, CompileStatic also enables type checking.  There is no need to
   include both transformations (and I seem to recall including both broke
   something for me at one point because the transformation was being applied
   twice -- though I could be recalling incorrectly).

-Keegan

On Wed, May 27, 2015 at 12:13 PM, Owen Rubel <orubel@gmail.com> wrote:

> aw sweet! Bookmark-a-mundo! :)
>
> Owen Rubel
> 415-971-0976
> orubel@gmail.com
>
> On Wed, May 27, 2015 at 9:00 AM, Steve Amerige <Steve.Amerige@sas.com>
> wrote:
>
>>  Hi all,
>>
>> Jochen showed us how to default to CompileStatic
>> <http://groovy.329449.n5.nabble.com/Changing-the-default-to-CompileStatic-tp5723113p5723114.html>
>> in a post a few months ago.  A question was raised about about changing the
>> default to TypeChecked for the case where a user doesn't want CompileStatic
>> as a default, but does want TypeChecked as a default.  Would it be the same
>> solution as above?  That is:
>>
>> *config.groovy*
>>
>> withConfig(configuration) {
>>     ast(groovy.transform.TypeChecked)
>> }
>>
>> and then do:  groovyc -configscript src/conf/config.groovy
>> src/main/groovy/MyClass.groovy
>>
>> Also, if one were to specify:
>>
>> *config.groovy*
>>
>> withConfig(configuration) {
>>      ast(groovy.transform.CompileStatic)
>>  }
>>
>> would that also mean that TypeChecked is enabled by default?  How is it
>> disabled for a given class or method?  Or, would one need to do the
>> following?
>>
>> *config.groovy*
>>
>> withConfig(configuration) {
>>      ast(groovy.transform.CompileStatic)
>>     ast(groovy.transform.TypeChecked)
>>  }
>>
>> In summary, I'm asking:
>>
>>    1. Is adding ast(groovy.transform.TypeChecked) in the config file how
>>    to turn on TypeChecked by default?
>>    2. What is the idiom to disable TypeChecked for a given class or
>>    method?
>>    3. Does CompileStatic imply TypeChecked (so that if CompileStatic is
>>    specified, it is not necessary to specify TypeChecked in a config file)?
>>
>> Thanks,
>> Steve Amerige
>>  Principal Software Developer, Fraud and Compliance Solutions Development
>> SAS Institute, 100 SAS Campus Dr, Room U3050, Cary, NC 27513-8617
>>
>>
>>
>> P.S.  By the way, having the ability to set the default for strong type
>> checking and static compilation while at the same time allowing for
>> specific exceptions (via @CompileDynamic, for example) has been very useful
>> in reducing push-back regarding Groovy adoption.  Similarly, disallowing
>> @Grab
>> <http://groovy.329449.n5.nabble.com/Disabling-Grape-tp5720694p5721122.html>
>> as C├ędric suggests is also part of helps enterprises embrace Groovy. I
>> encourage people to promote this and other similar features when
>> encountering resistance!  I think there should be an entire section in the
>> documentation that focuses on issues like these that are of interest to
>> large enterprises.
>>
>
>

Mime
View raw message