Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


- - - - -

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Violet CLM   Members   -  Reputation: 187

Like
0Likes
Like

Posted 13 September 2013 - 04:40 PM

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.

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3455

Like
0Likes
Like

Posted 14 September 2013 - 09:05 AM

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

#3 Andreas Jonsson   Moderators   -  Reputation: 3455

Like
0Likes
Like

Posted 18 September 2013 - 07:20 PM

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

#4 Violet CLM   Members   -  Reputation: 187

Like
0Likes
Like

Posted 19 September 2013 - 04:21 AM

Excellent, thank you! smile.png

#5 Violet CLM   Members   -  Reputation: 187

Like
0Likes
Like

Posted 28 September 2013 - 03:39 PM

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/==.

Edited by Violet CLM, 28 September 2013 - 04:00 PM.


#6 Andreas Jonsson   Moderators   -  Reputation: 3455

Like
0Likes
Like

Posted 29 September 2013 - 10:30 AM

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

#7 Andreas Jonsson   Moderators   -  Reputation: 3455

Like
0Likes
Like

Posted 29 September 2013 - 11:25 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS