> < ^ Date: Wed, 21 May 1997 15:33:00 +0100 (MET)
> < ^ From: Thomas Breuer <Thomas.Breuer@Math.RWTH-Aachen.DE >
^ Subject: Re: bug in Read/Edit cycle

Dear GAP Forum,

Joe Kincaid had written the following message.

(...) I ran
into something that appears to be a bug. In trying to define the "*"
operation, I made a change to the file and did not see the change appear
when I returned to GAP. Specifically, as a trace through the routine, I
added Print( ... ); statements, but nothing was printed out when I
expected. I then exited GAP and immediately started it up again. I loaded
the library and tested it. This time the behavior was exactly what I was

My understanding of Edit( ... ) is that it reads in the file being
edited before returning to GAP. This is what generally happens. For some
reason, though, this did not happen for me this one time. Any ideas?

The observed behaviour is not related to 'Edit'.
What happened here is that the computations after reading the edited file
were done with objects that had been defined before editing the file.

To explain the situation,
suppose a file contains a definition of a global variable,
a list or a record, and assignments to some positions or components,
such as

MyOps := OperationsRecord( "MyOps", RingOps );
MyOps.Print := function( a ) Print( "hello" ); end;

Then you read the file and say

old:= MyOps;

Then you edit the file, such that it contains the statements

MyOps := OperationsRecord( "MyOps", RingOps );
MyOps.Print := function( a ) Print( "oh, no!" ); end;

Now 'old.Print' is different from 'MyOps.Print';
note that 'old = MyOps' returns 'true' in spite of this fact.
Replacing the definition of the global variable by

if not IsBound( MyOps ) then
MyOps := OperationsRecord( "MyOps", RingOps );

should solve the problem.

Kind regards

> < [top]