On Thu, Sep 15, 2011 at 8:47 AM, Allen Wirfs-Brock <al...@wirfs-brock.com>wrote:
[...]

> No the normal use case for WeakMaps is simply to make associations between
> objects and arbitrary values.  The special GC behavior is necessary to avoid
> memory leaks, but that is a quality of implementation issue, not a use case.
>
> The typical JS programmer who wants to form such associations is not going
> to be thinking about the possibility of a leaky map unless they have already
> been burnt by them in some other language.
>

I do not know of a non-leak-association-map in *any* other language or
library whose name does not suggest its GC role. Do you know of a
counter-example? If not, then let's say "...burnt by them in every other
language...". A programmer approaching ES6 wanting simply to make
associations and not thinking about GC issues will probably reach for the
(iteratable) Map anyway, which is how it should be. For them, the
iterability of these maps will often be seen as a virtue. If they are
unconcerned about storage, they will usually see little reason to give up on
this iterability.



>
> Because, the majority of JS programmers will simply be looking for a way to
> "map objects to values" and will not be thinking about GC consequences.  We
> want them to find this thing we are currently trying to name.  We don't want
> them to miss it because it has "weak" in its name and they don't know what
> weak means. We need to design first for the 95% (ass generated number) of JS
> programmers who don't understand GC.
>

Those programmers *should* find our interatable maps, not our
weak-association maps.


>
> Finally, none are good exemplars for typical JS programmers.  We (and our
> friends)  know too much and in general have a level of PL expertise that far
> exceeds that of the typical JS programmer. In cases such as this our
> expectations may be the exact opposite of a typical JS programmer.


There are many kinds and levels of programmers. For the typical programmers
you talk about, I'd just point them at our current iteratable Maps and Sets.


-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to