[swift-evolution] [proposal] Allow convenience initializers to use "self = Foo()"
Charles Constant
charles at charlesism.com
Sun Oct 9 16:15:31 CDT 2016
Does anyone else think we should allow assignment to self in Class
"convenience init" methods?
Ie: this is legal for a struct, but complains about self being immutable if
you try it in a Class, even if it's a convenience init:
init( foo:String ){
self = Me( bar:foo )
}
I haven't seen this proposed so far, but is there even a reason why can't?
I've run into headaches with this a couple times lately. Specifically,
where the appropriate construct for my code seemed to be an init, but I
didn't have access to the desired required init, only a class function.
It's also confusing if you decide to change some Type from a struct to a
class, to find you have to turn an init into a static function.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161009/d2d104d7/attachment.html>
More information about the swift-evolution
mailing list