The reasons of making object extends its companion class?

700 views
Skip to first unread message

Shark.Z

unread,
Feb 14, 2011, 9:01:46 AM2/14/11
to lif...@googlegroups.com
When using Lift Mappers, it's common to see code like this
object Post extends Post with LongKeyedMetaMapper[Post]

And there're several places in Lift API, I can see object extends its companion class.
object BindHelpers extends BindHelpers{ }

What's the meaning of this kind of usage?

David Pollak

unread,
Feb 14, 2011, 9:08:33 AM2/14/11
to lif...@googlegroups.com
On Mon, Feb 14, 2011 at 6:01 AM, Shark.Z <evo...@gmail.com> wrote:
When using Lift Mappers, it's common to see code like this
object Post extends Post with LongKeyedMetaMapper[Post]

So the MetaMapper can get the fields in the Mapper.
 

And there're several places in Lift API, I can see object extends its companion class.
object BindHelpers extends BindHelpers{ }

So that there's a trait available with various methods that you can mix into your classes.

The design of the traits that compose into Helpers is probably the biggest mistake in Lift.  It should have been all one big singleton.  Maintaining the separate traits is a real bear.  Finding the methods you want in traits scattered all over the place is a real bear.  People mix the various traits into classes and then have implicit mismatches (although this is less common in Scala 2.8).
 

What's the meaning of this kind of usage?

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics
Reply all
Reply to author
Forward
0 new messages