- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
I am a bit confused on how JASS treats
Thus for example these two objects should not be equal, since while they have the same values for fields, they have different memory locations.
Assuming this is the correct behavior for objects in JASS, I do not understand this behavior from this point of view.
If I sketched the behaviors wrong, please correct me. I understand it doesn't really make much logical sense to have unique instances of
So what happens when we create a new
What other instances behave this way?
I am a bit confused on how JASS treats
boolexpr
instances. From my understanding of OOP from Java and Python, an object instance is unique when it is created, i.e. it is allocated its own memory. Thus for example these two objects should not be equal, since while they have the same values for fields, they have different memory locations.
JASS:
location A = Location(0,0)
location B = Location(0,0)
//this should return false
if A == B then
call print("I'm wrong!")
endif
//location B should not be null
call RemoveLocation(A)
if B != null then
call print("I'm right!")
endif
Assuming this is the correct behavior for objects in JASS, I do not understand this behavior from this point of view.
JASS:
boolexpr A = Condition(function main)
boolexpr B = Condition(function main)
//from my understanding, A and B should be unique instances
//but that's not really true apparently.
call DestroyBoolExpr(A)
//now B won't work anymore!
If I sketched the behaviors wrong, please correct me. I understand it doesn't really make much logical sense to have unique instances of
boolexpr
since its just a callback to an immutable function. So what happens when we create a new
boolexpr
instance which has already be made? Does JASS simply tell it to point to the oldest one, e.g.
JASS:
boolexpr A = Condition(function main)
//this is equivalent to: boolexpr B = Condition(function main)
set B = A