David, First apologies for accidently taking this thread off the lift group. It was entirely accidental.
So my question with regards to the scala language that I can't seem to find an answer for online anywhere is what exactly is an object nested inside a class i.e. : class ObjectWrapper { object obj extends AnyRef{var prop = "prop"} } versus a class with a final val that's set to an instance of an anonymous class i.e. : class AnonClassWrapper{ final val obj = new AnyRef{var prop="prop"} } I've tried to discover some sort of behavioral difference both in simple tests in the scala console, and couldn't find any. In both clases obj responds just as if it was a val and not a type. This analogy towards static classes in java breaks down because a static class in java is one that doesn't have a containing instance, and yet: scala> class ObjectWrapper{var outerProp = "prop"; object obj extends AnyRef{var prop=outerProp}} defined class ObjectWrapper lastly, in a desperate attempt to prove to myself that there is an actual difference I went against your rule and changed a RequestVar from an object extending RequestVar to a value set to an instance of an anonymous extention and my lift app ran without any changes in behavior??? On Aug 4, 10:42 am, David Pollak <feeder.of.the.be...@gmail.com> wrote: > In this case, if you change the type/behavior of the SessionVar and/or > RequestVar, you could mess up code that depends on these. > > You also must *always* make RequestVar and SessionVar as object rather than > val so that they can make the determination of their unique string ID. > > I view ProtoUser much like I view Rails' scaffolding... at some point the > code becomes too heavy to keep subclassing and it's easier to copy the > MegaProtoUser code into your own User class and go from there. > > > > > > On Tue, Aug 4, 2009 at 10:27 AM, E. Biggs <tacoban...@gmail.com> wrote: > > > I have extended Mega*ProtoUser to achieve cookie-based perpetual > > login.. and it was fairly easy to do except I ended up having to do > > something hackish simply because there are two private object members > > in the class that are core to the functionality I've extended. > > > Namely: > > > private object curUserId extends SessionVar[Box[String]](Empty) > > > private object curUser extends RequestVar[Box[ModelType]] > > (currentUserId.flatMap(id => getSingleton.find(id))) > > > I have no idea if this would be an acceptable change, but at least for > > one user of lift it would make much more sense that in the spirit of > > *ProtoUser's clear intent for extensibility that these members simply > > become: > > > protected val curUserId = new SessionVar[Box[String]](Empty){} > > > protected val curUser = new RequestVar[Box[ModelType]] > > (currentUserId.flatMap(id => getSingleton.find(id))){} > > > Unless I'm not properly understanding what object members actually > > are? I'm interpreting them as being final vals assigned to instances > > of anonymous classes (rough tests in the scala console seem to verify > > this) > > -- > Lift, the simply functional web frameworkhttp://liftweb.net > Beginning Scalahttp://www.apress.com/book/view/1430219890 > 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---