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 ( https://lampsvn.epfl.ch/trac/scala/ticket/1695 ) 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[_]

4 comments:

Ricky Clarkson

Can't you use Class[_]?

Fanf

Wow, I was sure I tested it in the first place (I was already it by that kind of behaviour: http://fanf42.blogspot.com/2009/01/tapestry-5-with-scala.html ), 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.

http://paste.pocoo.org/show/103689/

Fanf

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 Ourblogtemplates.com 2008

Back to TOP