[swift-users] Still can't derive from a generic class

Kenny Leung kenny at mail.hexdreams.com
Wed Aug 30 12:30:54 CDT 2017


Just curious, and because I have a distinct lack of imagination: can you share a concrete case of this pattern?

Thanks!

-Kenny


> On Aug 29, 2017, at 10:04 AM, Joanna Carter via swift-users <swift-users at swift.org> wrote:
> 
> Hi
> 
> I would have hoped by now that it should be possible to do :
> 
> class BaseObject<rootType : AnyObject>
> {
> }
> 
> class Test : BaseObject<Test>
> {
> }
> 
> All compiles well but, at runtime, when calling let test = Test(), I get a "EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)" error.
> 
> This is something I have been able to do in C# for many a year. Why oh why can I still not do it in Swift ?
> 
> Joanna
> 
> --
> Joanna Carter
> Carter Consulting
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users



More information about the swift-users mailing list