Advertisement

Difference between x.opEquals(y) and x==y with funcdefs?

Started by September 13, 2013 10:40 PM
5 comments, last by WitchLord 11 years, 1 month ago
I have a value class with a registered opEquals method that takes a function, like so:
ASengine->RegisterObjectMethod("SOMEVALUETYPE", "bool opEquals(const SOMEFUNCDEF@ &in)", asMETHOD(INTERNALVERSIONOFTHATVALUETYPE,operator==), asCALL_THISCALL);
There is likewise an opAssign method. Any of the following work fine in AngelScript, where svt is a variable of type SOMEVALUETYPE and f is a function of type SOMEFUNCDEF:
svt = f;
svt.opAssign(f);
if (svt.opEquals(f)) {}
However,
if (svt == f) {}
does not compile, returning instead:

WARN : The operand is implicitly converted to handle in order to compare them
ERR : Both operands must be handles when comparing identity


Shouldn't == work the same way as opEquals, like = works the same way as opAssign? It did in v2.26.3 (or maybe .2, not sure), but seems to have changed at some point since then.

I'll look into this.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've fixed this bug in revision 1727.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Excellent, thank you! smile.png
This feels like a related issue, so I kept in the same topic, but I might be wrong. I mentioned opAssign and = working the same way, but that's not always the case. If the function f is inside of a namespace, then svt.opAssign(ns::f) works just fine, but svt = ns::f crashes. Specifically it would seem to crash the executable at some point during the code compilation, since it doesn't matter if the line never even gets called by anything.
EDIT: The same is true for opEquals/==.

Thanks. I'll look into it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've fixed this problem in revision 1734.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement