ajwang / groovypptest

Automatically exported from code.google.com/p/groovypptest
0 stars 0 forks source link

Support @dynamic and @mixed for methods #340

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have implemented @dynamic amd @mixed for annotating methods in .gpp.
I intended to make it works only at the method-level because .gpp source files 
are statically typed by default. So there is no reason to apply @dynamic or 
@mixed for classes in .gpp files.

What version of the product are you using?
0.4.155

Patch will follow. This issue is filed to reserve the issue number for writing 
test cases.

Original issue reported on code.google.com by chanwit on 19 Feb 2011 at 12:02

GoogleCodeExporter commented 8 years ago
Can we please make it @Dynamic & @Mixed and have it available in any Groovy code

Original comment by alex.tka...@gmail.com on 19 Feb 2011 at 5:52

GoogleCodeExporter commented 8 years ago
in the case of gpp, since it's static by default, it make case to have 
dynamic/mixed to "escape" the static nature.

since .groovy is dynamic by default, what would be the usage case to use 
dynamic/mixed?

Original comment by wmacgy...@gmail.com on 19 Feb 2011 at 6:20

GoogleCodeExporter commented 8 years ago
@Typed class A {
    def staticMethod () {}
   @Dynamic def dynamicMethod () {}
}

Original comment by alex.tka...@gmail.com on 19 Feb 2011 at 6:42

GoogleCodeExporter commented 8 years ago
Hi Chanwit, did you send this patch by an email separately, by any chance?

If not, could you please send it? It will be good to have shorter annotations 
@Dynamic/@Mixed/@Static enabling various compilation modes in Groovy++.

Original comment by roshanda...@gmail.com on 30 May 2011 at 6:36

GoogleCodeExporter commented 8 years ago
I am submitting it.

Two annotations in this patch are made lower cases. (It does not have @static 
yet.)
Refactoring their names is trivial, anyway.

Sorry that I didn't have time enough to finish their test cases.

Original comment by chanwit on 30 May 2011 at 1:20

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by alex.tka...@gmail.com on 30 May 2011 at 1:25

GoogleCodeExporter commented 8 years ago
Thanks for the patch, Chanwit. 

I added some tests for covering usage of @Dynamic/@Mixed in both groovy/gpp 
files and here is the final commit: 
https://github.com/roshandawrani/groovypp/commit/3dd088f08704206433789a778194ebe
4cf6812fa

Original comment by roshanda...@gmail.com on 2 Jun 2011 at 7:15

GoogleCodeExporter commented 8 years ago
I am wondering that for consistency, whether we should also have @Static.

The previous patch is based on having @Typed / @Mixed / @Dynamic.

Original comment by roshanda...@gmail.com on 2 Jun 2011 at 7:21

GoogleCodeExporter commented 8 years ago
IMHO, @Static would be confusing with the semantics of the Java's static. So I 
am not sure about having this annotation.
(My usage is with .gpp - not .groovy - and it's statically typed by default.)

Original comment by chanwit on 2 Jun 2011 at 7:37

GoogleCodeExporter commented 8 years ago

Original comment by roshanda...@gmail.com on 2 Jun 2011 at 1:16