elyctech / web-gill

Gill is a WebGL-based rendering utility.
MIT License
0 stars 0 forks source link

Decide Mutability of IndexCollection Array #11

Open dawsonc623 opened 7 years ago

dawsonc623 commented 7 years ago

The provided implementation of IndexCollection implements toArray by simply returning the internal Array. This means that any change done to the Array returned will actually change the contents of the IndexCollection itself. Right now, this really causes no issue, but it is possible that other implementations may not react well to that.

It should be clearly defined whether IndexCollection implementations should enforce mutability through the Array returned from toArray or prevent it. Otherwise, code utilizing the current mutable implementation could break if moving to an implementation where that mutability is not upheld or behaviour is undefined for attempting to mutate in that fashion.