Oke so what works now is explicitly calling “toString”. However when boxing it it still becomes an integer (thats how we store simple enums). The next version will also allow this:
import java.util
public protocol Serializable
{}
public enum Blah: Serializable
{
case ONE
case TWO
case THREE
public override func toString() -> String
{
switch (self)
{
case .ONE: return "ONE"
case .TWO: return "TWO"
case .THREE: return "FOUR"
}
}
}
writeLn(Blah.ONE().toString());
the protocol name doesn’t matter, but adding a protocol to an enum will emit a wrapper class that will probably work better for you.