(adding on)

> On 22 déc. 2015, at 12:02, Matthew Johnson <matt...@anandabits.com> wrote:
> 
> Why would you have an immutable instance member that is always going to have 
> a constant value of 1?

That’s obviously a toy example. You can also use function calls, and that’s 
useful:

public struct A {
  public let property = random()
}

Would it make sense to allow a user in a different module write an extension 
that subverts the `let` by assigning via a new initializer?

extension A {
  init(_ value: Int) {
    self.property = value // ouch!
  }
}

Cheers,
Guillaume Lessard

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

Reply via email to