> I think I may be similarly misunderstanding your proposal; your intention
> then is to import the type as an enum with raw value (to facilitate the
> conversion to/from the C code) but without exposing that raw value on the
> Swift side?
>
> In that case I think I’m in favour.
Me too.
But
Yes, exactly, that’s a great summary of the proposal!
> El 25 mar 2016, a las 12:25, Haravikk escribió:
>
>
>> On 25 Mar 2016, at 09:56, Carlos Rodríguez Domínguez via swift-evolution
>> wrote:
>>
>> The key of this proposal is that
The key of this proposal is that the struct/class should come from outside any
swift source code, that is, either imported by the compiler from C, or
auto-generated from any external tool (i.e., a CoreData autogenerated class
from a graphically specified data model). Of course, in well written
Why can’t you do this? No raw values required, except to initialize the enums.
struct Card {
enum Suit : Int { case Hearts, Spades, Diamonds, Clubs }
enum Rank : Int { case Ace, Two, Three, Four, Five, Six, Seven, Eight,
Nine, Jack, Queen, King }
let suit : Suit
let rank : Rank
I would rather have a syntax that mirrors the way Protocol does it.
struct Card {
suit:enum
value:Int
}
or we could change it so this only excepts the enum itself unless
you explicitly cast from a Int or another enum:
struct Card {
suit:CardSuit
value:Int
}