[Lift] Re: is there a name for this pattern?

2009-06-20 Thread Eric Bowman
Eric Bowman wrote: The basic trick where a superclass has its subclass as a type parameter, e.g. class User extends MegaProtoUser[User] I've run into this before, I remember struggling to get it, then getting it, but I can't recall the epiphany. But obviously this is a relatively common

[Lift] Re: is there a name for this pattern?

2009-06-20 Thread David Pollak
Having type parameters on Mapper classes helps with a lot of things and is not going to go away. Marius and I discussed this a bunch of months ago onlist. Basically, the QueryParam (stuff that's passed to find(), findAll(), etc.) must be type checked against the current Mapper so you don't pass

[Lift] Re: is there a name for this pattern?

2009-06-19 Thread Jeremy Day
Eric, I believe that something like that, in C++ at least, is referred to as the curiously recurring template pattern. Jeremy On Fri, Jun 19, 2009 at 1:18 AM, Eric Bowman ebow...@boboco.ie wrote: The basic trick where a superclass has its subclass as a type parameter, e.g. class User

[Lift] Re: is there a name for this pattern?

2009-06-19 Thread David Pollak
On Thu, Jun 18, 2009 at 11:18 PM, Eric Bowman ebow...@boboco.ie wrote: The basic trick where a superclass has its subclass as a type parameter, e.g. class User extends MegaProtoUser[User] The circular dependent type that gives Martin and the compiler fits? :-) I've run into this

[Lift] Re: is there a name for this pattern?

2009-06-19 Thread Kris Nuttycombe
I've always called this recursive type parameterization. It's useful when the base class needs to know the type that it's eventually instantiated as, usually so that it can provide implementations of methods where dispatch is based upon the instantiated type. I've found myself using the pattern

[Lift] Re: is there a name for this pattern?

2009-06-19 Thread Xavi Ramirez
This is also a common technique in C# too. Unfortunately, I'm not sure of the pattern's name either. I usually just google for non-generic inheritance from generic class On Fri, Jun 19, 2009 at 10:31 AM, Jeremy Dayjeremy@gmail.com wrote: Eric, I believe that something like that, in C++

[Lift] Re: is there a name for this pattern?

2009-06-19 Thread Randall R Schulz
On Thursday June 18 2009, Eric Bowman wrote: The basic trick where a superclass has its subclass as a type parameter, e.g. class User extends MegaProtoUser[User] I've run into this before, I remember struggling to get it, then getting it, but I can't recall the epiphany. But obviously

[Lift] Re: is there a name for this pattern?

2009-06-19 Thread Alex Boisvert
On Thu, Jun 18, 2009 at 11:18 PM, Eric Bowman ebow...@boboco.ie wrote: The basic trick where a superclass has its subclass as a type parameter, e.g. class User extends MegaProtoUser[User] I've run into this before, I remember struggling to get it, then getting it, but I can't recall the