Requiring self. to access properties and methods


(Florian) #1

Hi all,

I prefer prefixing property (and method) access with self. in my code. This makes it immediately obvious if a variable is local to the function or actually a property of the instance.

I assume this has already been discussed and would like to know why it was decided to not require self for property and method access.

—Florian


(Johan K. Jensen) #2

It has already been brought up in the (multiple) mail chains named "Proposal:
Re-instate mandatory self for accessing instance properties and functions
<https://lists.swift.org/pipermail/swift-evolution/2015-December/000209.html>
".
You can find more threads and replies to that discussion at
https://lists.swift.org/pipermail/swift-evolution/.

—Johan

···

On Mon, Dec 7, 2015 at 6:21 PM, Florian Reinhart via swift-evolution < swift-evolution@swift.org> wrote:

Hi all,

I prefer prefixing property (and method) access with self. in my code.
This makes it immediately obvious if a variable is local to the function or
actually a property of the instance.

I assume this has already been discussed and would like to know why it was
decided to not require self for property and method access.

—Florian
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution