Quantcast

class reference notation in scaffolded code

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

class reference notation in scaffolded code

Dierk König
Hi,

I suggest removing the superfluous '.class' notation from
the scaffolded code since unlike Java, Groovy understands:

def a = [x: String]
assert a.x instanceof Class

,which reads much nicer.

cheers
Mittie
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: class reference notation in scaffolded code

graemer
On 02/03/06, Dierk Koenig <[hidden email]> wrote:
> Hi,
>
> I suggest removing the superfluous '.class' notation from
> the scaffolded code since unlike Java, Groovy understands:
>
> def a = [x: String]
> assert a.x instanceof Class
>
> ,which reads much nicer.

Wow, I didn't know that.. you learn something new in Groovy-land every day :-)

Graeme

>
> cheers
> Mittie
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: class reference notation in scaffolded code

Dierk König
> > def a = [x: String]
> > assert a.x instanceof Class
..
> Wow, I didn't know that.. you learn something new in Groovy-land
> every day :-)

*hehe* today, I went through chapter 5 with one of the GinA
reviewers who pointed at the switch example saying "cool: it uses
only Foo without .class"!
It actually took me some seconds to realize why my code was working at
all... :-)

I will add a more prominent explanation of vanilla name resolution
to chapter 6.

cheers
Mittie
Loading...