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.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to