Reputation: 866
Why the mapper fields in Lift framework is defined as Objects inside the class? Why not them as vals? When I look at their Wiki page, it says that for some internal reasons of Scala, we are making them as Objects instead of val or var. What is the internal reason or hinderence in Scala?
Upvotes: 2
Views: 187
Reputation: 38958
From The Definitive Guide to Lift, p83:
... fields are defined as objects rather than instance members (vars) [because] MetaMapper needs access to fields for its validation and form functionality; it is more difficult to cleanly define these properties in the MetaMapper if it had to access member vars on each instance since a MetaMapper instance is itself an object.
Upvotes: 2