Re: [swift-dev] Casting shadow protocols

2016-11-09 Thread Joe Groff via swift-dev
> On Nov 8, 2016, at 4:41 PM, Dave Abrahams via swift-dev > wrote: > > The msg send built in is worse than exploiting AnyObject magic. I'd rather > fall back to that As a builtin, we could probably constrain it to be type safe. The AnyObject magic implementation right now implies a bunch of

Re: [swift-dev] Casting shadow protocols

2016-11-08 Thread Dave Abrahams via swift-dev
on Tue Nov 08 2016, Alexis wrote: >> On Nov 8, 2016, at 6:22 PM, Andrew Trick wrote: >> >> >>> On Nov 7, 2016, at 12:15 PM, Alexis via swift-dev >>> wrote: >>> > >>> Does _unsafeReferenceCast at least verify that the types in >>> question could theoretically be cast into each other? That i

Re: [swift-dev] Casting shadow protocols

2016-11-08 Thread Dave Abrahams via swift-dev
The msg send built in is worse than exploiting AnyObject magic. I'd rather fall back to that Sent from my moss-covered three-handled family gradunza > On Nov 8, 2016, at 4:34 PM, Alexis wrote: > > > >> On Nov 8, 2016, at 6:22 PM, Andrew Trick wrote: >> >> >>> On Nov 7, 2016, at 12:15 PM,

Re: [swift-dev] Casting shadow protocols

2016-11-08 Thread Alexis via swift-dev
> On Nov 8, 2016, at 6:22 PM, Andrew Trick wrote: > > >> On Nov 7, 2016, at 12:15 PM, Alexis via swift-dev >> wrote: >> >> Does _unsafeReferenceCast at least verify that the types in question could >> theoretically be cast into each other? That is, one is derived from the >> other? If so,

Re: [swift-dev] Casting shadow protocols

2016-11-08 Thread Andrew Trick via swift-dev
> On Nov 7, 2016, at 12:15 PM, Alexis via swift-dev wrote: > > Does _unsafeReferenceCast at least verify that the types in question could > theoretically be cast into each other? That is, one is derived from the > other? If so, that would probably be an acceptable improvement. (the best we >

Re: [swift-dev] Casting shadow protocols

2016-11-08 Thread Dave Abrahams via swift-dev
on Tue Nov 08 2016, Michael Gottesman wrote: >> On Nov 7, 2016, at 11:23 AM, Alexis via swift-dev >> wrote: >> >> >>> On Nov 4, 2016, at 11:55 PM, Dave Abrahams via swift-dev >>> > wrote: >>> > >>> >>> on Fri Nov 04 2016, Slava Pestov >>

Re: [swift-dev] Casting shadow protocols

2016-11-08 Thread Michael Gottesman via swift-dev
> On Nov 7, 2016, at 11:23 AM, Alexis via swift-dev wrote: > > >> On Nov 4, 2016, at 11:55 PM, Dave Abrahams via swift-dev >> mailto:swift-dev@swift.org>> wrote: >> >> >> on Fri Nov 04 2016, Slava Pestov > > wrote: >> >>> If the casts are always in one direct

Re: [swift-dev] Casting shadow protocols

2016-11-08 Thread Joe Groff via swift-dev
> On Nov 4, 2016, at 4:29 PM, Alexis via swift-dev wrote: > > The swift standard library has this nasty little pattern/problem in it: > > The types in the core library want to know about several types defined in > foundation: NSString, NSArray, NSDictionary, etc. But core is imported by > Fou

Re: [swift-dev] Casting shadow protocols

2016-11-07 Thread Dave Abrahams via swift-dev
on Mon Nov 07 2016, Alexis wrote: > Does _unsafeReferenceCast at least verify that the types in question > could theoretically be cast into each other? That is, one is derived > from the other? Not IIRC > If so, that would probably be an acceptable improvement. (the best we > could ever hope

Re: [swift-dev] Casting shadow protocols

2016-11-07 Thread Alexis via swift-dev
Does _unsafeReferenceCast at least verify that the types in question could theoretically be cast into each other? That is, one is derived from the other? If so, that would probably be an acceptable improvement. (the best we could ever hope to do?) > On Nov 7, 2016, at 2:30 PM, Dave Abrahams wr

Re: [swift-dev] Casting shadow protocols

2016-11-07 Thread Dave Abrahams via swift-dev
on Mon Nov 07 2016, Alexis wrote: >> On Nov 4, 2016, at 11:55 PM, Dave Abrahams via swift-dev >> wrote: >> >> >> on Fri Nov 04 2016, Slava Pestov > > wrote: >> >>> If the casts are always in one direction, can you make one protocol >>> refine another? >> >>

Re: [swift-dev] Casting shadow protocols

2016-11-07 Thread Alexis via swift-dev
> On Nov 4, 2016, at 11:55 PM, Dave Abrahams via swift-dev > wrote: > > > on Fri Nov 04 2016, Slava Pestov > wrote: > >> If the casts are always in one direction, can you make one protocol >> refine another? > > Yeah, I am shocked if they don't do that alread

Re: [swift-dev] Casting shadow protocols

2016-11-04 Thread Dave Abrahams via swift-dev
on Fri Nov 04 2016, Slava Pestov wrote: > If the casts are always in one direction, can you make one protocol > refine another? Yeah, I am shocked if they don't do that already. > Also note that @objc protocols are self-conforming as long as they > don’t contain initializers or static methods,

Re: [swift-dev] Casting shadow protocols

2016-11-04 Thread Slava Pestov via swift-dev
If the casts are always in one direction, can you make one protocol refine another? Also note that @objc protocols are self-conforming as long as they don’t contain initializers or static methods, but I’m not sure if that helps. > On Nov 4, 2016, at 4:29 PM, Alexis via swift-dev wrote: > > Th

[swift-dev] Casting shadow protocols

2016-11-04 Thread Alexis via swift-dev
The swift standard library has this nasty little pattern/problem in it: The types in the core library want to know about several types defined in foundation: NSString, NSArray, NSDictionary, etc. But core is imported by Foundation, so it can’t (circular references between modules). Thankfully,