in reply to Re: What is the best way to compare variables so that different types are non-equal?
in thread What is the best way to compare variables so that different types are non-equal?
Is there a way to override this so that things belonging to different data types are always not equal?
I'm not sure if I understood your application, you're comparing "nodes" which can be strings or regexes or other data types, right?
So wouldn't it be natural to construct a class "Node", with an overloaded "eq" operator? (¹)
If your goal is to compare different node-objects, why don't you implement them as objects?
If you also tie these object-refrences you can use them like normal scalars.
So the answer is yes you might be able override this behaviour ;-)
Cheers Rolf
FOOTNOTE: (1) hmm I think I'd rather prefere to overload ==
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: What is the best way to compare variables so that different types are non-equal?
by ELISHEVA (Prior) on Jul 19, 2009 at 23:59 UTC |