[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-jsr
Subject:    Re: [groovy-jsr] when to fail while resolving names to class members at compile time
From:       Guillaume Laforge <glaforge () gmail ! com>
Date:       2006-01-20 9:29:14
Message-ID: 197b18fc0601200129i7203146fx () mail ! gmail ! com
[Download RAW message or body]

On 20/01/06, Jochen Theodorou <blackdrag@gmx.org> wrote:
> I have the following script
>
>            class ForLoopTest {
>              def testme() {
>                for (i in [1,2]) {
>                }
>                println i
>              }
>            }
>
>            def f = new ForLoopTest()
>            f.testme()


"i" should be resolved at runtime against the metaclass of the ForLoopTest.
So the default metaclass will certainly throw an exception at runtime
saying there's a property missing.

But it might be interesting to have an optional flag in the compiler
or a marker annotation to say that the class should be considered more
strictly so that at least a warning be returned in case such non-bound
names are found: @WarnUnboundName or something...

--
Guillaume Laforge
Groovy Project Manager
http://glaforge.free.fr/blog/groovy

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic