gap-system / gap

Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra
https://www.gap-system.org
GNU General Public License v2.0
763 stars 159 forks source link

in general, do not use a known `Name` value in `PrintObj` #5701

Open ThomasBreuer opened 1 month ago

ThomasBreuer commented 1 month ago

This addresses #5699.

For more than 25 years, there is a PrintObj method with high rank that just prints a known Name value of the object in question. According to the documentation of Name, a known Name value should be used only by View and ViewObj; the function Print is recommended to show GAP input to reconstruct the object in question if this makes sense.

When we remove the PrintObj method in question, the tests from testinstall and teststandard show differences essentially in two situations:

(Let us see the results of the other tests, perhaps there are more differences.)

ThomasBreuer commented 1 month ago

No, apparently the CI tests do not complain about the proposed change. So is this a reasonable solution to Leonard's problem?

Stefan-Kohl commented 1 month ago

Would this really be a good idea? -- I mean, for example assume you name an object "X". Then, as I understand, with your proposal this would still be "Print"ed as "X", as there is a global variable named "X". (Or did I misread something?)

ThomasBreuer commented 1 month ago

@Stefan-Kohl

Would this really be a good idea? -- I mean, for example assume you name an object "X". Then, as I understand, with your proposal this would still be "Print"ed as "X", as there is a global variable named "X". (Or did I misread something?)

Well, this has been the behaviour since more than 25 years, and nobody has reported a problem with it. Yes, one can set misleading names. If a user does this then it is his/her fault, and View will continue showing these names. (I think that function names such as X cause less confusion than names of objects such as Rationals.)

I think that Name should not be set by library functions, but this is another question to be answered.