From: Toby A. <tob...@pe...> - 2004-07-11 19:06:43
|
On Fri, Jul 09, 2004 at 01:45:10PM -0400, Ken Anderson wrote: > At 12:22 PM 7/9/2004 -0400, Geoffrey Knauth wrote: > >On Jul 9, 2004, at 10:36, Ken Anderson wrote: > >>Q1`: > >>In src/jsint/Evaluator.java: > >>public DynamicEnvironment INTERACTION_ENVIRONMENT > >> > >>Should this be static final, or should it be named > >>interactionEnvironment? > > > >Would anyone ever override/replace the interaction environment? > >If yes, I vote the latter. If no, I vote the former. > > Yes, i think it should be an instance field. Yes, I forgot to change its name when I made the patch to make it an instance field. > The DV also has a field that is used to store the value during > serialization. > > This explanation has helped me understand this, and i found a slight > bug in serialization and i have a new proposal for DV and DE which > i'll send in my next message. I also have found a bug in the serialization of DynamicVariables, for which I as going to submit a patch this week. The one I found has to do with serializing DynamicVariables that are created as the result of Java-dot notation. My (not cleaned up) fix is below. Index: src/jsint/DynamicVariable.java =================================================================== RCS file: /cvsroot/jscheme/jscheme/src/jsint/DynamicVariable.java,v retrieving revision 1.4 diff -r1.4 DynamicVariable.java 5a6 > boolean isDefined; 19,20c20,23 < // create the binding < setDynamicValue(storedDynamicValue); --- > // create the binding if it was defined > if (isDefined) { > setDynamicValue(storedDynamicValue); > } 43c46,51 < out.writeObject(getDynamicValue()); --- > if (getDynamicEnv().isDefined(name)) { > out.writeBoolean(true); > out.writeObject(getDynamicValue()); > } else { > out.writeBoolean(false); > } 56c64,67 < storedDynamicValue = in.readObject(); --- > isDefined = in.readBoolean(); > if (isDefined) { > storedDynamicValue = in.readObject(); > } Toby. |