What's stopping the instances from managing themselves? ------------------------------------- Jim Barrows<[email protected]> wrote:
On Mon, Nov 2, 2009 at 1:16 PM, Vesa <[email protected]> wrote: > > By the way, why orm classes need to be aware of the companion object? > Could this dependency be eliminated somehow? > The Mapper/Record companion object is where the code to do all the DB stuff lives. These are all static methods, they don't really change per instance of the class itself. The companion object is one way Scala allows you to do this. It's probably also the most convenient. An answer to the question: What is the rationale behind having companion objects in scala.<http://stackoverflow.com/questions/609744/what-is-the-rationale-behind-having-companion-objects-in-scala> > > - Vesa > > On 2 marras, 22:02, Vesa <[email protected]> wrote: > > I doubt I can find one, but it still feels awkward having to type the > > name of the class so many times. Another option could be to use some > > shared object to do this stuff, but I guess it wouldn't be as neat to > > use it then. > > > > - Vesa > > > > On 2 marras, 18:33, David Pollak <[email protected]> > > wrote: > > > > > > > > > On Mon, Nov 2, 2009 at 8:14 AM, Vesa <[email protected]> wrote: > > > > > > It seems like boilerplate that every mapped class needs to define a > > > > getSingleton method returning companion object. Can't there be any > > > > default with this and is there any way to get rid of the manually > > > > defined companion object if user isn't going to define any new > methods > > > > on it, while still having the default meta functionality? > > > > > I know of no mechanism in Scala to discover companion objects. If you > find > > > one (that's not simply Java Reflection), please let me know. > > > > > > - Vesa > > > > > -- > > > Lift, the simply functional web frameworkhttp://liftweb.net > > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > > Follow me:http://twitter.com/dpp > > > Surf the harmonics > > > -- James A Barrows --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
