-
-
Notifications
You must be signed in to change notification settings - Fork 761
Closed
Description
Right now for one event we reference directly:
a = {};
a.on("foo", print);
trace(a);
#2547[r1,l1] Object {
#2087[r1,l2] Name String [2 blocks] "#onfoo" #2088[r1,l0] NativeFunction 0x2751d (16) { }
}
But for two we use an array:
a = {};
a.on("foo", print);
a.on("foo", print);
trace(a);
#2547[r1,l1] Object {
#2087[r1,l2] Name String [2 blocks] "#onfoo" #4432[r1,l0] Array(2) [
#3204[r1,l2] Name Integer 0 #2088[r1,l0] NativeFunction 0x2751d (16) { }
#4437[r1,l2] Name Integer 1 #5[r1,l0] NativeFunction 0x2751d (16) { }
]
}
This saves space, but it has the effect that when events are queued they are either queued referencing the function, or the array, depending on how many handlers there are, which can subtly affect the behaviour.
Given the small overhead (2 vars extra) we should just simplify the code an always use an array, which makes handling the same.
Metadata
Metadata
Assignees
Labels
No labels