Now is still the time for source breaking changes if well motivated, when 
dealing with key aspects of the language and we can make them objectively 
better then we ought to act when we can I think.

+1

Sent from my iPhone

> On 17 Jan 2017, at 06:11, Pranshu Goyal via swift-evolution 
> <[email protected]> wrote:
> 
> Definitely a +1, this clarifies intent, but enums are used a lot in swift 
> code, and considering this is a source breaking change I'm not sure if many 
> users of swift are going to be positive about this.
> 
>> On 17 January 2017 at 02:32, David Waite via swift-evolution 
>> <[email protected]> wrote:
>> Or perhaps paint the bikeshed 
>> 
>> enum Something<(Int32, Int32)> { … }
>> 
>> -DW
>>> On Jan 16, 2017, at 11:51 AM, Anton Zhilin via swift-evolution 
>>> <[email protected]> wrote:
>>> 
>>> This idea by Karl made me branch off a new thread.
>>> 
>>> 2017-01-16 21:28 GMT+03:00 Karl Wagner <[email protected]>:
>>> 
>>> 
>>> 
>>>> It would be helpful for synthesised RawRep conformance. The 
>>>> inheritance-like syntax we have now is awful - it makes people think that 
>>>> RawRepresentable is some kind of magic protocol that will allow special 
>>>> compiler jango to happen.
>>>> 
>>>> You could see why they think that. This looks very much like the enum is 
>>>> going to *be* an Int32:
>>>> 
>>>> enum Something: Int32 {
>>>>     case oneThing = 36
>>>>     case anotherThing = 42
>>>> }
>>>> 
>>>> This is also one of the icky parts to allowing tuples of integer/string 
>>>> literals (something people ask for quite a lot). It would look like you’re 
>>>> deriving your enum from a non-nominal type:
>>>> 
>>>> enum Something: (Int32, Int32) {
>>>>     case oneThing = (3, 12)
>>>>     case anotherThing = (5, 9)
>>>> }
>>> 
>>> 
>>> Even if Swift gains newtype, it’s not that case. The enum does not gain 
>>> methods or behavior of the specified type. It’s just a shorthand, hinting 
>>> the compiler to provide correct RawRepresentable conformance.
>>> 
>>> I suggest to invent a new syntax for this type hinting for 
>>> RawRepresentable. For example, it can be an annotation:
>>> 
>>> @raw(Int32) enum Something {
>>>     // ...
>>> }
>>> Or a contextual keyword:
>>> 
>>> enum Something : raw(Int32) {
>>>     // ...
>>> }
>>> Perhaps, he most uniform and explicit of syntaxes:
>>> 
>>> enum Something : RawRepresentable {
>>>     case oneThing = 36
>>>     case anotherThing = 42
>>> }
>>> 
>>> enum AnotherThing : RawRepresentable {
>>>     typealias RawValue = Int32
>>>     case oneThing
>>>     case anotherThing
>>> }
>>> _______________________________________________
>>> swift-evolution mailing list
>>> [email protected]
>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>> 
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> [email protected]
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>> 
> 
> 
> 
> -- 
> Pranshu Goyal
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to