{Weak|}{Map|Set}
Kyle Simpson
getify at gmail.com
Thu Sep 15 07:56:47 PDT 2011
> If I was a programmer
> looking for something like weak referencing in JS for the first time,
> "weak" is what I'd be searching for.
But if you're actually aware of weakrefs (as I am), and you're searching for
them in JS (as I was), and you see "WeakMap" (as I did), and you make the
conclusion that "Weak" in the name means in fact weak references (as I did),
then you probably also (as I did) assume that *all* the refs are weak.
That's a failed conclusion, because only the keyrefs are weak.
The name doesn't do anything to enlighten you that it only offers weak
keyrefs and not weak valuerefs -- in fact, by your "discovery" line of
reasoning, the name is almost a landmine that traps/misleads someone who
does in fact know about weakrefs -- someone who didn't know about weakrefs
wouldn't necessarily make the same deductive assumption by seeing "weak" in
the name.
Misleading/confusing with an API name is, IMHO, worse than less
implementation-self-descriptive naming.
--Kyle
More information about the es-discuss
mailing list