Whoops, you added the static typing info while I was replying.. Can that @TypeChecked be added at the class level? Within a typechecked class can you still use all/most of the Groovy features or is it basically Java within there? I might grab a copy and play around, thanks for at least the information you've already provided, Russell. On Jul 23, 2012 6:34 AM, "Ricky Clarkson" <[email protected]> wrote:
> Sure, I generally do stick with static languages. Groovy was promoted as > a step up from Java, though, which until that line of code is rejected, it > clearly isn't. A step sideways, perhaps. > > Isn't Groovy adding static typing now? Will that line be rejected > thereafter? > > Java's lack of type inference.. sure. Does Groovy infer types? > On Jul 23, 2012 6:24 AM, "Russel Winder" <[email protected]> wrote: > >> On Sun, 2012-07-22 at 16:41 -0300, Ricky Clarkson wrote: >> > Let me know when int i = "hello"; is rejected by the compiler and I'll >> look >> > again. >> >> Clearly you are a static typing sort of person, so stick with static >> typed languages. Dynamically typed languages do not obey the same typing >> rules as statically typed languages, and nor should they; the whole >> point is that statically and dynamically typed languages are different. >> >> int i = 'Hello' >> >> can never be caught as an error at compile time by a dynamically typed >> language since all type checking is at run time. Groovy correctly >> throws an exception on this line with ClassCastException. >> >> Conversely, tell me when typing works properly in Java. >> >> ArrayList<String> x = new ArrayList<String> ( ) ; >> >> really? Why? This is 201x, surely type inference should be an integral >> part of any modern language. And really: >> >> ArrayList<String> x = ArrayList<> ( ) ; >> >> is just no solution at all. >> >> -- >> Russel. >> >> ============================================================================= >> Dr Russel Winder t: +44 20 7585 2200 voip: >> sip:[email protected] >> 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] >> London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder >> > -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
