trait AbstractPersistentChannel[T <: AbstractPersistentChannel[T]] extends
LongKeyedMapper[T] {
    self: T =>
  }

  trait AbstractPersistentMetaChannel[T <: AbstractPersistentChannel[T]]
 extends
  LongKeyedMetaMapper[T] {  self: T with AbstractPersistentMetaChannel[T]
=>}


class ChannelA extends AbstractPersistentChannel[ChannelA] with IdPK {
  def getSingleton = ChannelA
}
class ChannelB extends AbstractPersistentChannel[ChannelB]  with IdPK {
  def getSingleton = ChannelB
}

// And there are some objects which use that trait:

object ChannelA extends ChannelA with
AbstractPersistentMetaChannel[ChannelA]
object ChannelB extends ChannelB with
AbstractPersistentMetaChannel[ChannelB]

*type SomeMetaT = (AbstractPersistentMetaChannel[T] forSome {type T <:
AbstractPersistentChannel[T]})*
// I now have a list of those and have a can to store an element of that
list::
   var cType: Can[SomeMetaT] = Full(ChannelA)

   def showForm: JsCmd = {
     val form = cType.map(_.create.toForm(Empty, c => c.save())) openOr
Nil
JsCmds.Noop
   }

def createTypeSelect: Seq[(SomeMetaT, String)] = {
    * List[(SomeMetaT, String)]*((ChannelA, "Channel A"),
          (ChannelB, "Channel B"))
}

Important stuff in Bold.  Most notably, the type inferencer gets Lists wrong
sometimes.

On Wed, Dec 10, 2008 at 1:42 PM, Joachim A. <[EMAIL PROTECTED]>wrote:

>
> David,
> that works much better. With a little help the compiler almost made it ;)
> There's now another problem with that I can't fix atm (I snipped the
> packages
> away).
>
> [WARNING] Channels.scala:83: error: type mismatch;
> [WARNING]  found   : ChannelA.type (with underlying type object ChannelA)
> [WARNING]  required: SomeMetaT
> [WARNING]       List((ChannelA, "Channel A"), (ChannelB, "Channel B"))
> [WARNING]             ^
>
> //The code:
>
> type SomeMetaT = T forSome {type T <:
> AbstractPersistentMetaChannel[AbstractPersistentChannel[T]]}
>
> def createTypeSelect: Seq[(SomeMetaT, String)] = {
>      List((ChannelA, Channel A"), (ChannelB, "Channel B"))
> }
>
>
> // the classes and objects:
> object ChannelA extends ChannelA with
> AbstractPersistentMetaChannel[ChannelA]
> class ChannelA extends AbstractPersistentChannel[ChannelA] {...}
>
> Thanks for your help,
> Joachim
>
>
>
>
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to