[Review] SE-0068: Expanding Swift Self to class members and value types


(Pelaia II, Tom) #1

I like this proposal, but my only hesitation is using “Self” from within the context of an instance method. That just doesn’t seem write for two reasons:
1) “Self" differs from “self” by just the first letter being capitalized. Regardless of case, it is confusing for the terms “self” or “Self” or “SELF” to mean different things from within the same context.
2) It makes the code harder to read by having “Self” and “self” mean two different things.

I’d accept the proposal as is, if instead a different term were used, such as “Type”. If you use “Type” from the context of an instance method there is not ambiguity in its meaning and the code would be more readable.


(Brent Royal-Gordon) #2

1) “Self" differs from “self” by just the first letter being capitalized. Regardless of case, it is confusing for the terms “self” or “Self” or “SELF” to mean different things from within the same context.

What, you've never done things like this?

let page = Page()
let document = Document(pages: [page])

let account = Account(oAuthToken: token)
account.addDocument(document)

···

--
Brent Royal-Gordon
Sent from my iPhone


(L Mihalkovic) #3

I couldn't understand for a moment why people would think that “Self" versus "self” is confusing.. and then I remembered that Apple does not (by default) distinguish file names with different casing in the filesystem… I think we either educate people or we keep them ignorant in the name of their best interest. Apple seem to regularly choose the bottom end. I hope after 40 years someone will decide it is time to look forward and embrace Self

···

On Apr 21, 2016, at 3:14 AM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

1) “Self" differs from “self” by just the first letter being capitalized. Regardless of case, it is confusing for the terms “self” or “Self” or “SELF” to mean different things from within the same context.

What, you've never done things like this?

let page = Page()
let document = Document(pages: [page])

let account = Account(oAuthToken: token)
account.addDocument(document)

--
Brent Royal-Gordon
Sent from my iPhone

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


(Jeremy Pereira) #4

1) “Self" differs from “self” by just the first letter being capitalized. Regardless of case, it is confusing for the terms “self” or “Self” or “SELF” to mean different things from within the same context.

What, you've never done things like this?

let page = Page()
let document = Document(pages: [page])

let account = Account(oAuthToken: token)
account.addDocument(document)

I have, but I always feel a tinge of guilt when I do it. I know I shouldn’t.

Fortunately, karma is satisfied because Xcode autocomplete punishes me by always putting the capitalised version as the top choice.

···

On 21 Apr 2016, at 02:14, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

--
Brent Royal-Gordon
Sent from my iPhone

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


(Goffredo Marocchi) #5

Don't get me started on the case insensitive file system in OS X, some programs still do not work right without it and it is a cause of errors that just piss me off... especially when you share data outside of the happy case insensitive castle :/.

[[iOS messageWithData:ideas] broadcast]

···

On 21 Apr 2016, at 06:10, L Mihalkovic via swift-evolution <swift-evolution@swift.org> wrote:

I couldn't understand for a moment why people would think that “Self" versus "self” is confusing.. and then I remembered that Apple does not (by default) distinguish file names with different casing in the filesystem… I think we either educate people or we keep them ignorant in the name of their best interest. Apple seem to regularly choose the bottom end. I hope after 40 years someone will decide it is time to look forward and embrace Self

On Apr 21, 2016, at 3:14 AM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

1) “Self" differs from “self” by just the first letter being capitalized. Regardless of case, it is confusing for the terms “self” or “Self” or “SELF” to mean different things from within the same context.

What, you've never done things like this?

let page = Page()
let document = Document(pages: [page])

let account = Account(oAuthToken: token)
account.addDocument(document)

--
Brent Royal-Gordon
Sent from my iPhone

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

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


(Erica Sadun) #6

Capitalized Self already exists in the language. This proposal extends the use to add consistency. Would you prefer to remove it entirely?

For example: http://stackoverflow.com/questions/27863810/swift-difference-between-self-and-self

-- E

···

On Apr 21, 2016, at 5:53 AM, Jeremy Pereira via swift-evolution <swift-evolution@swift.org> wrote:

On 21 Apr 2016, at 02:14, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

1) “Self" differs from “self” by just the first letter being capitalized. Regardless of case, it is confusing for the terms “self” or “Self” or “SELF” to mean different things from within the same context.

What, you've never done things like this?

let page = Page()
let document = Document(pages: [page])

let account = Account(oAuthToken: token)
account.addDocument(document)

I have, but I always feel a tinge of guilt when I do it. I know I shouldn’t.

Fortunately, karma is satisfied because Xcode autocomplete punishes me by always putting the capitalised version as the top choice.


(Pelaia II, Tom) #7

I regularly work with Linux and am quite comfortable with case sensitive file systems, but I wouldn’t ever use the same name differing only in case in the same directory. To me, file names or variable names should be meaningful independent of case. Of course, with the language we have the convention on using cases that imply what something is. That is a good thing. For me, the case is used more often to add clarity of meaning than to resolve different entities with the same name except for case. Using “Self” and “self” is certainly consistent with the language rules and naming convention, but not something I think should be encouraged.

···

On Apr 21, 2016, at 1:10 AM, L Mihalkovic <laurent.mihalkovic@gmail.com<mailto:laurent.mihalkovic@gmail.com>> wrote:

I couldn't understand for a moment why people would think that “Self" versus "self” is confusing.. and then I remembered that Apple does not (by default) distinguish file names with different casing in the filesystem… I think we either educate people or we keep them ignorant in the name of their best interest. Apple seem to regularly choose the bottom end. I hope after 40 years someone will decide it is time to look forward and embrace Self

On Apr 21, 2016, at 3:14 AM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org<mailto:swift-evolution@swift.org>> wrote:

1) “Self" differs from “self” by just the first letter being capitalized. Regardless of case, it is confusing for the terms “self” or “Self” or “SELF” to mean different things from within the same context.

What, you've never done things like this?

let page = Page()
let document = Document(pages: [page])

let account = Account(oAuthToken: token)
account.addDocument(document)

--
Brent Royal-Gordon
Sent from my iPhone

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org<mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution


(Tal Atlas) #8

I’m totally fine with the case difference and overall like the change. I’m
just not sure if this just an alias for `self.dynamicType` that it’s worth
that sugar at this point.

-Tal

···

On Thu, Apr 21, 2016 at 8:16 AM, Pelaia II, Tom via swift-evolution < swift-evolution@swift.org> wrote:

I regularly work with Linux and am quite comfortable with case sensitive
file systems, but I wouldn’t ever use the same name differing only in case
in the same directory. To me, file names or variable names should be
meaningful independent of case. Of course, with the language we have the
convention on using cases that imply what something is. That is a good
thing. For me, the case is used more often to add clarity of meaning than
to resolve different entities with the same name except for case. Using
“Self” and “self” is certainly consistent with the language rules and
naming convention, but not something I think should be encouraged.

On Apr 21, 2016, at 1:10 AM, L Mihalkovic <laurent.mihalkovic@gmail.com> > wrote:

I couldn't understand for a moment why people would think that “Self"
versus "self” is confusing.. and then I remembered that Apple does not (by
default) distinguish file names with different casing in the filesystem… I
think we either educate people or we keep them ignorant in the name of
their best interest. Apple seem to regularly choose the bottom end. I hope
after 40 years someone will decide it is time to look forward and embrace
Self

On Apr 21, 2016, at 3:14 AM, Brent Royal-Gordon via swift-evolution < > swift-evolution@swift.org> wrote:

1) “Self" differs from “self” by just the first letter being capitalized.
Regardless of case, it is confusing for the terms “self” or “Self” or
“SELF” to mean different things from within the same context.

What, you've never done things like this?

let page = Page()
let document = Document(pages: [page])

let account = Account(oAuthToken: token)
account.addDocument(document)

--
Brent Royal-Gordon
Sent from my iPhone

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

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