Convert Set/Get methods taking a single array into attributes
Categories
(Toolkit :: Places, defect, P3)
Tracking
()
People
(Reporter: mak, Unassigned)
References
Details
After Bug 1551779 converts our idls into Array<>, it looks like in a lot of cases (setTransitions, setParents...) we may go with an attribute instead, that is nicer for js consumers.
This could be split into single replacements mentored bugs.
Comment 1•5 years ago
|
||
It's a little dangerous to have an attribute that allocates a new array object on every get. People are much more likely to write inefficient code that iterates the array and allocates it anew for every item, effectively...
But as long as we avoid that, it's fine.
Reporter | ||
Comment 2•5 years ago
|
||
That's a good point, we'd need a way (lint?) to avoid that, that seems complicate.
I noticed a few consumers using Array <> with attribute https://searchfox.org/mozilla-central/search?q=attribute+Array<&case=false®exp=false&path=.idl and surely there's no automated check currently, so it's all based on review DD.
Let's keep this on the backburner for now, we may have some kind of checks in the future, or just wonfix.
It's likely also a good habit to avoid these Array attributes until we have an answer.
Updated•2 years ago
|
Description
•