Thursday, February 12, 2009

Tapestry 5 - Scala : start of delusion

I didn't write anything for a long time on my Tapestry 5 / Scala experiment. Things are starting to go wrong.

From one part, I found what may have been a bug in Scala ( ) and that delayed me lot in the use of T5 IoC binder.

For the other part, T5 IoC does not seems to support parameterized types at more than one level, and so I can't use parameterized class in contributions.

For example, I can't contribute Tuple, or (and that's quite a big limitation) class because in Scala, you can't use the unparameterized "Class" argument, it must be "Class[Something]", and here lies the hell of generics...

So for now, I'm beginning to thing that T5 and Scala don't feet so well together, or at least that I have some nuts to scratch and some "best practices" to find before going further in the test.

EDIT: as proposed by Ricky Clarkson, for the class problem, just use Class[_]


Ricky Clarkson

Can't you use Class[_]?


Wow, I was sure I tested it in the first place (I was already it by that kind of behaviour: ), but perhaps I changed some other things... Well, it works, so it's really cool :)

Thanks Ricky :)

That let me we the boiler plate that is the need to define traits or classes for all parametrized type, but at least I can go on a little more.

James Iry

This is Scala, we don't wimp out and use the API provided. We make a better API ;-)

Note that this uses the experimental, undocumented, and likely to murder kittens scala.reflect.Manifest.


Thanks for the tip James, the resulting syntax is really less verbose and more explicit - actually, that's a kind of constant pattern when it comes to compare Java and Scala.

It's a really nice use of implicits and experimental, undocumented feature. And sorry for the kittens :)

  © Blogger template 'Minimalist G' by 2008

Back to TOP