[swift-evolution] Proposal: Weak Native Swift Containers
Dmitri Gribenko
gribozavr at gmail.com
Thu Dec 10 18:35:05 CST 2015
On Thu, Dec 10, 2015 at 2:55 PM, Riley Testut via swift-evolution <
swift-evolution at swift.org> wrote:
> I think native swift collections with support for weak references for
> their contents would be very useful, and in more places than just listed
> above. I don’t think Array could be easily extended to support it (what
> happens if a value is released? does everything shift down? do they keep
> their indices?), but Set and Dictionary (where the keys and/or values could
> be weak, akin to NSMapTable) would be good candidates IMO.
>
Seems like an interesting direction to me, using value types as keys and
weak references in a dictionary-like data structure seems like a fequent
use case. A proposal in this area should include not just the API, but
also a discussion of the implementation strategy.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151210/2cf60072/attachment.html>
More information about the swift-evolution
mailing list