Re: Swift generics, circular type declarations, and segfaults, oh my!
Re: Swift generics, circular type declarations, and segfaults, oh my!
- Subject: Re: Swift generics, circular type declarations, and segfaults, oh my!
- From: has <email@hidden>
- Date: Tue, 08 Sep 2015 11:04:52 +0100
On 06/09/2015 21:19, Quincey Morris wrote:
I'm getting that sinking Radar feeling too. But since I'm relatively
new to Swift, I'm just holding out a vain hope that there's some sort
of solution that's embarrassingly obvious to everyone else but me.
I’ve been thinking about the implications of this for a couple of days
now. Of course, you should file a Radar if you see some compiler
behavior that looks like it ought to work. But I think there’s a
higher order problem that’s worth noting.
In my experience (which is to say, after a couple of months spent
converting a fair-sized app from Obj-C to Swift), converting an Obj-C
implementation to directly an “equivalent” Swift implementation is a
lousy experience with poor results.
Yeah, don't worry about that; it's not my first port project.:) It's
already been heavily redesigned in order to simplify the implementation,
and there's lots of reworking to tie it into Swift's static typing.
Ironically, it's trying to Swiftify it that's causing all the pain. I'd
already be done if I'd just stuck to using a single glue class as a dumb
'implements all operations, whether appropriate or not' wrapper around
the real mechanics (as the prototype does), rather than have the type
system intelligently enforce the rules on which operations can be
performed on what (which requires more complex class and protocol
structures, and circular type references).
Anyway, I think this pretty much wraps it up: Swift's type system is not
(yet?) as great as it ought to be (but that's maybe not surprising as
the language is still not properly baked) and just isn't going to
cooperate at this point. So I guess it's Plan B for now: forget about
generics-based reusability, and just duplicate (ugh) all the base
methods within the code-generated glues and put the correct signatures
on those. What matters most is that the UX works; code purity will just
have to wait.
Many thanks to all,
has
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Fritz Anderson <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Quincey Morris <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Quincey Morris <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Charles Srstka <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>) |
| >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Quincey Morris <email@hidden>) |