[swift-evolution] Mutability inference

Stephen Celis stephen.celis at gmail.com
Wed Feb 24 09:46:28 CST 2016


> On Feb 24, 2016, at 2:10 AM, David Smith via swift-evolution <swift-evolution at swift.org> wrote:
> 
> One tricky thing with languages like this (javascript, for example) is that it becomes easy to accidentally introduce a new variable rather than refer to an existing one.


There are ways around this.

I like mutability to be explicit, but do like the idea of making `let` optional in cases where it can be assumed a new variable is being introduced:

  let a: String = "string"
  b: String = "string" // short-hand avoids let
  b := "string" // shorter-hand

--
Stephen


More information about the swift-evolution mailing list