ArpEngine / ArpDomain

Asset and entity manager for ArpEngine
MIT License
0 stars 0 forks source link

Always coerce fields to concrete ds type #31

Closed kaikoga closed 4 years ago

kaikoga commented 5 years ago

Non-concrete ds types cannot be inlined, so slow (allocates iterators) Currently value ds fields are not coerced.

Hard part: How to define a Haxe interface of coerced ds types? (maybe we can use @:multitype abstracts)

kaikoga commented 4 years ago

Haxe supports covariant return types, so we can just coerce fields and let the compiler do plumbing (because reference ds fields are already always (get, never) and to also comply it on value ds fields seems natural)

kaikoga commented 4 years ago

@:multiType

No, no, no, no, no, no

kaikoga commented 4 years ago

We can no longer allow setters for collections if we actually start coercing... but is that an issue?

The correct way to set virtual collections is by value, or in other words, clear() and CollectionOp.copy(). Arbitrary implementation SHOULD NOT be injected later from outside, EVEN IF the collection is defined virtual. (Implementation is hard coded when defined by concrete ds anyway)