Open callendorph opened 1 year ago
This may be a non-issue. What I'm finding is that Unique/Finalizer
doesn't actually work for what I'm trying to accomplish. I end up getting out of order inc/dec on references and object deletion which causes std::abort
calls. I'm in the middle of refactoring this code to remove Unique
from most objects.
I think that it is possible that another library might want to use Unique
and override equal?
some day, but I don't have an active use case for such.
Hi,
I'm attempting to use operator overloading. I've run into an issue when attempting to use the
Unique
type as a sub-type for a class which has theequal?
operator.Here is an example project:
op_overload_test.zip
When I run without the
Unique
subtype - I get:This is the expected result.
When I run with the
Unique
subtype:So the issue here is the
Unique
has theEqualable
subtype.Equalable
defines its method as:Which means that the
==
operator can only returnTrue|False
- which means it can't return a value of type AST and meet the interface requirements.I can clearly work around this by not using
Unique
but for lostanza C wrappers, theUnique
class is pretty critical for making easy to use code.I don't see in
core.stanza
whereUnique
's requirement forEqualable
comes from. The Liveness tracker seems to convert theref<Unique>
to along
for storage. I don't 'see a case where aUnique
object requires the==
comparison but I clearly haven't been through every bit of the compiler/core code.Do you have a suggestion for how to proceed ? Does
Unique
require theEqualable
subtype ?