> On May 10, 2017, at 2:05 AM, Rick Mann wrote:
>
> This seems so obvious that I feel like it should be provided by the language
> by default. I suppose you can make it even more compact with
>
>case (.one, .one),
> (.two, .two),
> (.three, .three):
> return true
>
>
Rigorously, one should avoid to force the purpose of a given feature of a
language or library construct. If you use Equatable, you must take into account
the associated values for the sake of semantics.
However, you are free to create your own infix operator that could allow you
compare your en
On 10 May 2017, at 09:23, Brent Royal-Gordon via swift-users
wrote:
> (given your "ignore the associated type" semantic)
This is the bit that worries me. The docs for `Equatable` are very clear that
it implies /substitutability/, which is not the case if you ignore the
associated values.
<
> On May 10, 2017, at 01:23 , Brent Royal-Gordon wrote:
>
>> On May 8, 2017, at 2:01 AM, Rick Mann via swift-users
>> wrote:
>>
>> Seriously, I've been googling this for a half-hour, and I can't find an
>> answer (everything that comes up is for ErrorType, absolutely nothing for
>> Error).
> On May 8, 2017, at 2:01 AM, Rick Mann via swift-users
> wrote:
>
> Seriously, I've been googling this for a half-hour, and I can't find an
> answer (everything that comes up is for ErrorType, absolutely nothing for
> Error).
>
> I have an enum:
>
> enum MyErrors : Error
> {
>case one(S
I think you'd better define your own operator, maybe `=~` or something
else. As `==` has already meant something in enum.
Zhaoxin
On Mon, May 8, 2017 at 5:07 PM, Rien via swift-users
wrote:
> I’d love to know if there is a better way, but a ‘switch’ or 'if case' is
> the only way I know.
>
> Re
I’d love to know if there is a better way, but a ‘switch’ or 'if case' is the
only way I know.
Regards,
Rien
Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Balancingrock
Project: http://swiftfire.nl - A server for websites build in Swift
> On 08
Seriously, I've been googling this for a half-hour, and I can't find an answer
(everything that comes up is for ErrorType, absolutely nothing for Error).
I have an enum:
enum MyErrors : Error
{
case one(String)
case two
case three(String)
}
let a: MyErrors = .one("foo")
let b = .two