[swift-evolution] [Review] SE-0131: Add AnyHashable to the standard library

Dmitri Gribenko gribozavr at gmail.com
Mon Jul 25 23:18:03 CDT 2016


On Mon, Jul 25, 2016 at 1:12 PM, Nate Cook via swift-evolution
<swift-evolution at swift.org> wrote:
>>       https://github.com/apple/swift-evolution/blob/master/proposals/0131-anyhashable.md
>
> +1!
>
> This proposal looks great to me. I only have one nitpick: it looks like there's a '_Hashable' protocol used in the Dictionary extension to get around the limit on generic subscripts. Swift has managed to remove most (all?) underscored protocols from public APIs, so I would just suggest that the implementation consider an alternate name that isn't underscored. Something like 'HashableBase' would still imply that the protocol is more of an implementation detail than a useful protocol on its own.

Hi Nate,

I don't see a benefit for this.  Nobody should be using _Hashable.
Adding it as a non-underscored protocol increases API surface for no
benefit.  _Hashable is slated for removal as soon as we get the
necessary compiler features.

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>*/


More information about the swift-evolution mailing list