You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (Jira)" <ji...@apache.org> on 2019/08/30 16:37:00 UTC

[jira] [Comment Edited] (GROOVY-8329) Consider statically typed/compiled as default for Groovy 3.0

    [ https://issues.apache.org/jira/browse/GROOVY-8329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16919704#comment-16919704 ] 

Daniel Sun edited comment on GROOVY-8329 at 8/30/19 4:36 PM:
-------------------------------------------------------------

I do not think Groovy should enable STC by default because Groovy's main advantage is its dynamic features. When we want better performance, {{@CompileStatic}} will give us a hand, but it is just a bonus. Also, STC is not mature enough as we can feel. Luckily, Groovy core team has been trying to refine STC over time. Many fixes are very hard to be merged into 2_5_X from master, so you will find STC support will be much better than before in Groovy 3.0.0. ( Our new committer [~emilles] contributes most of the STC fixes recently. Really thanks to his hard work! )

BTW, if you want to enable STC by default in your projects, here is an article for your reference:
 [https://medium.com/@jonashavers/how-to-activate-type-checking-for-all-groovy-classes-57ce785d5028]


was (Author: daniel_sun):
I do not think Groovy should enable STC by default because Groovy's main advantage is its dynamic features. When we want better performance, {{@CompileStatic}} will give us a hand, but it is just a bonus. Also, STC is not mature enough as we can feel. Luckily, Groovy core team has been trying to refine STC over time. Many fixes are very hard to be merged into 2_5_X from master, so you will find STC support will be much better than before in Groovy 3.0.0. ( Our new committer [~emilles] contributes most of the STC fixes recently. Really thanks to his hard work! )

BTW, if you want to enable STC in your projects, here is an article for your reference:
 [https://medium.com/@jonashavers/how-to-activate-type-checking-for-all-groovy-classes-57ce785d5028]

> Consider statically typed/compiled as default for Groovy 3.0
> ------------------------------------------------------------
>
>                 Key: GROOVY-8329
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8329
>             Project: Groovy
>          Issue Type: New Feature
>            Reporter: Endre Stølsvik
>            Priority: Major
>
> Personally, I do not understand why anyone would ever want to drop typing from JVM based languages (or in any other language, for that matter). Thus, I only started using Groovy "for real" when I discovered the @CompileStatic annotation, which really made everything great!
> If I could choose, I'd go for statically typed by default, with @DynamicCompile or somesuch as an annotation I could turn on for methods that uses the XML parsing features etc.
> To me, it seems like more and more people are realizing that statically typed languages is the way to go, notice e.g. TypeScript, Facebook's retrofitting of types onto PHP with Hack, and even PHP's own typing in PHP 7.
> Now with Kotlin joining the fray of JVM-based languages, whose literally first two words on the wepage is "statically typed", getting special support in Spring, and - notably - getting full support in Gradle, I'd say that this applies more than ever. If Groovy "looses Gradle" to Kotlin due to the ability to get a statically typed build script (oh, the joy!), I believe Groovy will have a much harder time attracting new users. Turning Groovy into one of the statically typed JVM languages, instead of hampering users with "everything is an Object"-based runtime resolution, will increase the appeal of the language.
> The 3.0 can be a great point to change this. It could of course be reverted back to previous logic by some -D switch (would need support in IDEs too, I guess), or by sticking some magic "whole-sale annotation" at the top of the source file, or something like this.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)