Hi Hugo,

I might change this in the near future. But for now, here is the general
'rule of thumb' that I use:

If the instance only has string keys (or int/uint/Number/Boolean keys
should be ok too) then use a plain Object. All code can pretty much then
remain unchanged.

If it is using object instances (any complex object like functions or class
instances, or generic object instances) as keys, then

a) use native js Map if the original constructor argument does not have
weakKeys=true, or if it has weakKeys= true and there is any form of
iteration over keys (you cannot iterate over keys in a WeakMap in
javascript)

b) otherwise use WeakMap.

Both (a) and (b) require you to change code for get/set ([]
access/assignment in as3) or delete operator, and also code related to
iteration (use map.forEach in js).
see docs for those:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap




On Sun, Nov 14, 2021 at 9:34 AM Hugo Ferreira <hferreira...@gmail.com>
wrote:

> Hi,
>
> I see that there is no Dictionary on Royale, probably because there is a
> better method.
> What the approach in Royale for a Dictionary ?
>

Reply via email to