> Problem 2: This can cause very surprising performance issues, because it 
> forces the let property to be stored.  With the previous example, it is a 
> goal for us to be able to compile:
> 
> public class X {
>   let a = 42
> }
> 
> into the equivalent of:
> 
> public class X {
>   var a : Int { return 42 }
> }
> 
> because people like to use local lets as manifest constants (avoiding “magic 
> numbers”).  With your proposal, we’d lose this capability, and we’d have to 
> store them any time there is a memberwise initializer.
> 
> Neither of these problems apply to vars, which is why I think we can support 
> vars in this model, but not lets.

Sorry to sidetrack the discussion, but does that mean that using `let` 
properties in a type where memory layout is important is possibly not 
forward-compatible?

Félix
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to