Move the overloads for the symbols $ and == for generic object types out of system into a new module.
Motivation
Objects are nominal types that often overload these procs. This can cause problems with uses of them in generic/template code that don't mix them in, and statically use the system module overload of them for objects. There were some open issues of this but it's hard to find them.
== for objects also has a limitation where, since it's defined in system, it can't use complex macro code, which means it can't support case objects easily since fieldPairs is unavailable for case objects (https://github.com/nim-lang/Nim/issues/6676).
Also in general people might not want their object types to have a default $/== overload like this. But sometimes they will, and they can have this by just importing the new module these would be in.
Notice the implementation is the same for tuples and objects. One option is to move these implementations to a private module, then export specialized versions for tuples and objects in separate modules.
Abstract
Move the overloads for the symbols
$
and==
for genericobject
types out of system into a new module.Motivation
Objects are nominal types that often overload these procs. This can cause problems with uses of them in generic/template code that don't mix them in, and statically use the system module overload of them for objects. There were some open issues of this but it's hard to find them.
==
for objects also has a limitation where, since it's defined insystem
, it can't use complex macro code, which means it can't support case objects easily sincefieldPairs
is unavailable for case objects (https://github.com/nim-lang/Nim/issues/6676).Also in general people might not want their object types to have a default
$
/==
overload like this. But sometimes they will, and they can have this by just importing the new module these would be in.Description
$ implementation, == implementation
Notice the implementation is the same for tuples and objects. One option is to move these implementations to a private module, then export specialized versions for tuples and objects in separate modules.
Inspired by https://github.com/nim-lang/Nim/pull/20185.
Code Examples
No response
Backwards Compatibility
This would be part of
-d:nimPreviewSlimSystem
. Any backwards compatibility issues are the same as the rest of the umbrella of that flag.