> On 25 Mar 2016, at 09:56, Carlos Rodríguez Domínguez via swift-evolution > <swift-evolution@swift.org> wrote: > > 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 > structures (as specified by Paul Ossenbruggen) we shouldn’t have any need for > this proposal. However, many C structures make use of a raw type instead of > an enum type, but specifying (through the associated documentation, not by > any type enforcement) that only a set of enum values are allowed. > Consequently, the resulting code making use of those structures becomes > highly error prone, and, particularly in swift, very “old-style” code and > difficult to understand for newcomers. > > Again, I would like to highlight that my proposal intends to avoid as much as > possible the use of enums’ raw values.
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. _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution