Dear All,

  

  The only thing I am really missing right now from Swift is described as
following. This works in some other languages, e.g.  F#, Kotlin, and Haskell.

  

  F# example (taken from https://fsharpforfunandprofit.com/posts/correctness-
immutability/)

  

let john = {firstName="John"; lastName="Doe"}

let alice = {john with FirstName="Alice"}

  

  Current way to do this in Swift is:

  

let john = (firstName:"John", lastName:"Doe")  
var alice = john  
alice.firstName = "Alice"  

  

  This might seem to be a nuance, but it's more cumbersome (especially if one
wants to do this frequently), and we are left with a var at the end.

  Also, this idea rhymes with the current direction of removing var arguments
from functions.

  What do You think? Thank You.

  

Zsolt

  

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

Reply via email to