[Ns-developers] Default Values

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Sat Jan 19 01:09:37 PST 2008


On Fri, 2008-01-18 at 21:27 -0500, Joseph Kopena wrote:
> Hi all,
> 
> First, a snippet from the Seattle meeting notes:
> 
>  > - Two conventions regarding default values will be adopted:
>  > -- Default values used to set values on an object should, in general,
>  >  also have getters and setters to access the value through the
>  >  object's interface.
>  > -- Default values may be used for initialization only, and can either
>  >  be global, static values or global but changeable per node.
> 
> My take on this was the same as Tom's---that this was talking about
> when objects are created, not necessarily restricting the use of
> default values to scenario construction.  The former seems reasonable
> to me, that default values should only be used to initialize objects
> and should not be referenced throughout its lifetime.  A related point
> is what I was talking about in regard to Craig's Set() function, it
> should be made clear that changing the default values does not effect
> already created objects.  To me that just sounds too chaotic.

What sounds chaotic ? Craig's generic Set ("path", value) proposal was
not related in any way to DefaultValues: it was related to an extension
of the Parameter proposal.

> 
> As I understand it, one of the issues ostensibly being addressed by
> limiting default value use to the construction phase is that code may
> change values without the user being aware, and cause hard to debug
> misbehavior.  However, it's not obvious to me that the factory
> getters/setters approach resolves that.  Wouldn't that code just as
> easily interact with the factory as change a default value?  It seems

Sure. However, it seems pretty obvious to me that calling a Setter on a
factory is not to going to influence in any way the behavior of an
object which has already been created by that factory. Or are you
referring to another problem ?

> like not using the default values adds new code (the getters/setters)
> without achieving the desired restriction.
> 
> What if default values could be locked, either system wide or by
> specific variables?  If anything tries to change one afterward, the
> sim bails and the user knows something's going on.

I am not sure I understand what you are proposing here.

Mathieu


More information about the Ns-developers mailing list