Re: [swift-evolution] [pitch] CopyInitializable for value-type semantics

2017-07-26 Thread Gor Gyolchanyan via swift-evolution
I like the idea of Clonable, because it involves the least amount of boilerplate and I do certainly agree that not having to care about whether or not the object is a value type or a reference type is good for robust generic programming. However, there are two problems that I see with it: * The

Re: [swift-evolution] [pitch] CopyInitializable for value-type semantics

2017-07-25 Thread Dave Abrahams via swift-evolution
on Tue Jul 25 2017, Gor Gyolchanyan wrote: > I like the idea of Clonable, because it involves the least amount of > boilerplate and I do certainly agree that not having to care about > whether or not the object is a value type or a reference type is good > for robust generic programming. > > Ho

Re: [swift-evolution] [pitch] CopyInitializable for value-type semantics

2017-07-25 Thread Dave Abrahams via swift-evolution
on Wed Jul 12 2017, Gor Gyolchanyan wrote: > Hello, swift community! > > Recently I’ve come across a dilemma regarding value-type semantics > when dealing with generic types. Consider a protocol that has a > mutating in-place function and a non-mutating returning variant of > that function: > >

Re: [swift-evolution] [pitch] CopyInitializable for value-type semantics

2017-07-12 Thread Gor Gyolchanyan via swift-evolution
Yes, NSNumber was a bad example. Immutable types can implement it and do a shallow copy, as you said. The NSCopying protocol won’t do because: It only works on @objc classes. Its proper use is deprecated (namely, the use of provided NSZone parameter is deprecated). It’s in Foundation framework, w

Re: [swift-evolution] [pitch] CopyInitializable for value-type semantics

2017-07-12 Thread Philippe Hausler via swift-evolution
> On Jul 12, 2017, at 3:23 AM, Gor Gyolchanyan via swift-evolution > wrote: > > Hello, swift community! > > Recently I’ve come across a dilemma regarding value-type semantics when > dealing with generic types. > Consider a protocol that has a mutating in-place function and a non-mutating >

[swift-evolution] [pitch] CopyInitializable for value-type semantics

2017-07-12 Thread Gor Gyolchanyan via swift-evolution
Hello, swift community! Recently I’ve come across a dilemma regarding value-type semantics when dealing with generic types. Consider a protocol that has a mutating in-place function and a non-mutating returning variant of that function: protocol Transmogrifier { mutating func transmogrify(