Implement lightweight syntax for component handling#591
Implement lightweight syntax for component handling#591ameligrana wants to merge 3 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Click to expand benchmark resultsTime is per entity/N, allocations are totals. Allocations are only shown for current.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@ameligrana Didn't you say:
😄 |
|
yes, but with that I meant that I didn't want to reimplement also In general I like this syntax, so I would like to introduce it. I'm also thinking that maybe shorten also our general syntax removing |
|
Basically, the only risk I see is that users may be tempted to store handles. Not sure how we can discourage that, except by the docs. |
|
I guess we can really break everything by defining something like Base.length(::AbstractArray{EntityHandle}) = throw(error("EntityHandle must not be stored into an array"))
Base.getindex(::AbstractArray{EntityHandle}, inds...) = throw(error("EntityHandle must not be stored into an array"))
Base.setindex!(::AbstractArray{EntityHandle}, v, inds...) = throw(error("EntityHandle must not be stored into an array")) |
|
https://docs.julialang.org/en/v1/manual/style-guide/#Don't-overload-methods-of-base-container-types seems to discourage this though |
|
I think just documenting that one should store entities directly is better in the end |
Fixes #565