[Pitch] Make Self an alias for object type in object definition

What do you guys think about aliasing the type of the current object with
the Self keyword?

E.g. instead of writing

class Test {
  static var value = 0

  func printValue() {
    print(Test.value)
  }
}

One could write

class Test {
  static var value = 0

  func printValue() {
    print(Self.value)
  }
}

It's dangerous to go alone. Take this with you.

-- E

···

On May 22, 2016, at 12:24 PM, Adam Nemecek via swift-evolution <swift-evolution@swift.org> wrote:

What do you guys think about aliasing the type of the current object with the Self keyword?

E.g. instead of writing

class Test {
  static var value = 0
  
  func printValue() {
    print(Test.value)
  }
}

One could write

class Test {
  static var value = 0
  
  func printValue() {
    print(Self.value)
  }
}

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

Lol, I'll search harder next time. :-)

···

On Sun, May 22, 2016 at 11:30 AM, Erica Sadun <erica@ericasadun.com> wrote:

https://github.com/apple/swift-evolution/blob/master/proposals/0068-universal-self.md

It's dangerous to go alone. Take this with you.

-- E

On May 22, 2016, at 12:24 PM, Adam Nemecek via swift-evolution < > swift-evolution@swift.org> wrote:

What do you guys think about aliasing the type of the current object with
the Self keyword?

E.g. instead of writing

class Test {
  static var value = 0

  func printValue() {
    print(Test.value)
  }
}

One could write

class Test {
  static var value = 0

  func printValue() {
    print(Self.value)
  }
}

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