[swift-users] Implicitly type conversion ?

Karl razielim at gmail.com
Thu Aug 25 05:35:41 CDT 2016


> On 19 Aug 2016, at 18:00, Tim Vermeulen via swift-users <swift-users at swift.org> wrote:
> 
> Any idea why Swift supports implicit casting to AnyHashable, but not to, say, AnySequence?
> 

It’s a hack until existential support gets better. Explicitly casting to AnyHashable clutters your dictionary literals.

There’s a fair amount of code in the compiler to support it, it’s probably just not worth the effort for other types (and since they were never anything else, nothing has regressed for them as it did for AnyHashable).


More information about the swift-users mailing list