[swift-evolution] Proposal: Re-instate mandatory self for accessing instance properties and functions (David Hart)
david at hartbit.com
Mon Dec 7 13:22:43 CST 2015
I strongly agree and that is why I quoted those two points in the proposal and why I believe that the proposal is beneficial: it brings clarity at the point of use.
> On 07 Dec 2015, at 19:38, Jordan Rose via swift-evolution <swift-evolution at swift.org> wrote:
> Without commenting on the rest of the proposal, Swift is not about verbosity. From the API Design Guidelines on Swift.org:
> • Clarity at the point of use is your most important goal. Code is read far more than it is written.
> • Clarity is more important than brevity. Although Swift code can be compact, it is a non-goal to enable the smallest possible code with the fewest characters. Brevity in Swift code, where it occurs, is a side-effect of the strong type system and features that naturally reduce boilerplate.
> I'd say the same should apply to the language itself.
>> On Dec 6, 2015, at 15:52, Yichen Cao via swift-evolution <swift-evolution at swift.org> wrote:
>> But swift is all about verbosity (with method naming and such brought from obj-c), having self is much clearer.
>>> On Dec 7, 2015, at 06:55, Nick Shelley <nickmshelley at gmail.com> wrote:
>>> I like that self is only required in closures because it serves as a good reminder that there are memory and safety implications with using self in a closure, such as creating retain cycles or having the closure run after self has been deallocated.
>>> I can't seem to find an official Apple Swift style guide, but github's (https://github.com/github/swift-style-guide) suggests only using self in closures with the rationale: "This makes the capturing semantics of self stand out more in closures, and avoids verbosity elsewhere."
>>>> On Sat, Dec 5, 2015 at 3:16 AM, Yichen Cao <ycao at me.com> wrote:
>>>> Teaching wise, its much less confusing for self to be required so students don't mix up instance properties and local vars. Especially when self is required in closures, it confuses students. If self is mandatory for all instance properties, it would be so much clearer and much easier to read.
>>>>> On Dec 5, 2015, at 18:11, swift-evolution-request at swift.org wrote:
>>>>> Re: Proposal: Re-instate mandatory self for accessing
>>>>> instance properties and functions (David Hart)
>>>> swift-evolution mailing list
>>>> swift-evolution at swift.org
>> swift-evolution mailing list
>> swift-evolution at swift.org
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution