[swift-users] Casting tuples to protocols always fails (and the compiler should know)

Joe Groff jgroff at apple.com
Mon Oct 10 12:57:36 CDT 2016


> On Oct 10, 2016, at 10:53 AM, Sebastian Hagedorn <sebastian at iosphere.de> wrote:
> 
> “Forever” is pretty long-term ;)
> 
> Since it is currently *not* possible for tuples to conform to protocols, isn’t it worth a warning (if my assumption that this would be easy to implement is correct), even if it may be obsolete in the future?

Yeah, even for non-tuples it may be worthwhile to offer a warning that there isn't a currently-visible protocol conformance for the type of the operand when it's a concrete type. You could easily enough silence the warning by writing 'as Any as? P' or something like that if you really want to.

-Joe


More information about the swift-users mailing list