Re: Override new

2024-11-23 Thread MG
Hi OC, I had to check (since I don't use code like that), and it is not overriding/overloading the new operator per se, but replacing a ctor of a class through its metaClass (see code below). Cheers, mg import groovy.transform.Canonical @Canonical class Goo { String s } @Canonical class Fo

Re: [EXT] Re: Using `var` as method return type placeholder

2024-11-23 Thread Gianluca Sartori
When we use @CompileStatic or @TypeChecked we are declaring we care about types. In such cases it is my opinion that `def` definitions as well should be subject to type inference (if it was implemented in Groovy). Because we are explicitly declaring that we care about types. At that point it is m

Override new (was: [EXT] Using `var` as method return type placeholder)

2024-11-23 Thread OCsite
Hi there, > On 23. 11. 2024, at 4:12, MG wrote: > Groovy new can be overridden to return a different type on purpose can it? How? (Aside of an ASTT which would be a bit at the complex side for such a trivial thing.) I must have missed this thing in the documentation somewhere, and searching th

Re: Using `var` as method return type placeholder

2024-11-23 Thread Jochen Theodorou
On 21.11.24 11:37, Gianluca Sartori wrote: Hello everybody, My name is Gianluca Sartori, from Italy, I am the author of the open source project Dueuno Elements (https://github.com/dueuno-projects/dueuno-elements ) and I am new to this list. I

Re: [EXT] Re: Using `var` as method return type placeholder

2024-11-23 Thread MG
On 23/11/2024 13:43, Gianluca Sartori wrote: When we use @CompileStatic or @TypeChecked we are declaring we care about types. Groovy always cares about the types of variables (unless you use def/Object, which is a design choice) - the question is only whether it checks for correct types durin