Subj : Re: Controlling evaluation of an expression To : netscape.public.mozilla.jseng From : zwetan Date : Thu Dec 02 2004 08:41 am Hi, > > I was wondering whether there is a way for me to control the > evaluation of certain expressions in Rhino. For example, normally > myObject.property evaluates to the integer value 1. But in the > context of a certain function call: > > myHostObject.myFunction( myObject.property ) > > I would like for Rhino not to evaluate myObject.property because it > has a different meaning in this context. Is this possible? > why not simply define the meaning of the context by code ? for ex: specialInteger = function( /*Int*/ num ) { this._value = num; } specialInteger.prototype.toSpecialContext = function() { //whatever you need here } specialInteger.prototype.valueOf = function() { return this._value; } myObject = {}; myObject.property = new specialInteger( 1 ); //for normal context the property will evaluate to its valueOf myHostObject.myFunction( myObject.property ) //for a particular context: myHostObject.myFunction( myObject.property.toSpecialContext() ) and same question here: what are you trying to do ? zwetan .