GlobalAssignHook

GlobalAssignHook -- a method name which is consulted when an assignment to a global variable occurs.

The method should be a function of two variables: the symbol to which a value is being assigned, and the value being assigned. The method should be stored under then name GlobalAssignHook in the class of the value.

This method is used for instances of Type and Ring to arrange for the name of the type or ring to be set to the name of the global variable to which it is first assigned.

     i1 = GlobalAssignHook RR := (sym,val) -> << concatenate (
     
               	  "assigning ", name val, " to ", name sym
     
          	  ) << endl
     
     o1 = --function--
     
     o1 : Function
     
     i2 = a=4.5
     
     assigning 4.5 to a
     o2 = 4.5
     
     o2 : RR
     
     i3 = a=5.4
     
     assigning 5.4 to a
     o3 = 5.4
     
     o3 : RR
     

See also GlobalReleaseHook.

Go to main index.

Go to concepts index.