|
|
|
|
|
by coolsunglasses
4161 days ago
|
|
>One of my favorite parts of Swift is the optional concept What if you need the fallback value to be an error possessing information about what went wrong? data Maybe a = Just a | Nothing
data Either a b = Left a | Right b
|
|
Personally, I just want higher-kinded types, and for the following code snippets to work as-is:
The first breaks because of the "Unimplemented non-fixed multi-payload enum layout" compiler error, and the second breaks because enums have value semantics. Both can be worked around in full generality by declaring a 'Box<T>' generic wrapper class, but that workaround is inelegant and cumbersome.