tags:

views:

51

answers:

1

Hi, 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?

+1  A: 

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.

Synesso