On 28.04.2016 10:34, Pyry Jahkola via swift-evolution wrote:

*    extension* Array {
        // Apologies for not having the time to think of a less contrived
example than this!
        *mutating* *func* quarter() {
            *mutate* *self*.halve() // Ever since SE-0009
<https://github.com/apple/swift-evolution/blob/master/proposals/0009-require-self-for-accessing-instance-members.md>,
it's unusual to use `self` here.
            *mutate*halve()      // Where would you put the `&` prefix in this?
        }
    }

How about '&' as allowed prefix/suffix for method name as a marker of mutating method? I.e.

self.&halve()
&halve()

or

self.halve&()
halve&()


Actually, IMO &halve() is not a variant as it probably could be used in function like

something( &halve )  - confused

so, the suggestion is to have '&' suffix as marker of mutating methid:

self.halve&()
halve&()


_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to