Skip to content

Commit 54da6b8

Browse files
committed
change the approach
- remove the offending `PrintObj` method - install individual `PrintObj` methods for the few objects that are affected (in our test suite) by this change
1 parent 58abade commit 54da6b8

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

lib/object.gi

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -375,24 +375,6 @@ function( str, zero )
375375
end );
376376

377377

378-
#############################################################################
379-
##
380-
#M PrintObj( <obj> )
381-
##
382-
InstallMethod( PrintObj,
383-
"for an object with name",
384-
true,
385-
[ HasName ],
386-
SUM_FLAGS, # override anything specific
387-
function( obj )
388-
if ISBOUND_GLOBAL( Name( obj ) ) then
389-
Print( Name( obj ) );
390-
else
391-
TryNextMethod();
392-
fi;
393-
end );
394-
395-
396378
#############################################################################
397379
##
398380
#M ViewObj( <obj> ) . . . . . . . . . . . . . . . . for an object with name

lib/overload.g

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,31 @@ InstallMethod( UpperCentralSeries, [ IsAlgebra ],
389389
InstallMethod( UpperCentralSeries, [ IsGroup ], UpperCentralSeriesOfGroup );
390390

391391

392+
#############################################################################
393+
##
394+
#M PrintObj( <obj> )
395+
##
396+
## For a few global variables, we want that their 'Name' value is used by
397+
## 'PrintObj'.
398+
## Note that in general we do not want that setting a 'Name' value changes
399+
## the behaviour of 'PrintObj'.
400+
##
401+
Perform( [ "IsGaussianIntegers", "IsGaussianRationals", "IsIntegers",
402+
"IsRationals" ],
403+
function( filtname )
404+
InstallMethod( PrintObj,
405+
[ filtname ],
406+
SUM_FLAGS, # override anything specific
407+
function( obj )
408+
if ISBOUND_GLOBAL( Name( obj ) ) then
409+
Print( Name( obj ) );
410+
else
411+
TryNextMethod();
412+
fi;
413+
end );
414+
end );
415+
416+
392417
DeclareGlobalFunction( "InsertElmList" );
393418

394419
InstallGlobalFunction(InsertElmList, function (list, pos, elm)

0 commit comments

Comments
 (0)