[GAP Forum] Replace Global Function

Alexander Hulpke hulpke at math.colostate.edu
Tue Oct 14 21:45:50 BST 2014


Dear Forum, Dear Luca Giuzzi,

> I would like to replace a function defined by
> DeclareGlobalFunction/InstallGlobalFunction
> Unfortunately, the object installed by InstallGlobalFunction is read-only, and
> Unbind also fails.
> Is there any way to mark the object as replaceable?

Assuming you know what you are doing (replacing some functions can lead to weird errors),
MakeReadWriteGlobal("TheFunction");
(note: String, not variable!) will remove write protection from 
TheFunction
and allow you to overwrite it.
MakeReadOnlyGlobal is the inverse operation.

If the issue is simply with reading in a file, using

Reread

instead of 

Read

will allow a second call to `InstallGlobalFunction' to overwrite the first instance.

Best wishes,

   Alexander Hulpke

-- Colorado State University, Department of Mathematics,
Weber Building, 1874 Campus Delivery, Fort Collins, CO 80523-1874, USA
email: hulpke at math.colostate.edu, Phone: ++1-970-4914288
http://www.math.colostate.edu/~hulpke






More information about the Forum mailing list