Pre-SIP: A New Type for Optionals and Error Handling (2)

I have to ask:
At what point does it become too special ?

From what I have gathered, here are the ways in which this proposal deviates from the Scala norm:

  • Promotes null instead of Option
    • This is a 180 which will lead to ecosystem fragmentation, unless converters are added (which increases the design surface, and can lead to downstream issues)
  • (related to the above) Adds a solution to an already solved problem (the “value of T or nothing” problem)
  • The value for “no result” is null and not () (the Unit value)
  • Is of shape [Good, Bad] instead of [Bad, Good] (although I would not consider this an argument against Good ? Bad)
  • Some typing rules depend on the nullability of the types
  • (the latest) It is only covariant in some specific cases (particularly surprising given it aims to replaceOption/Either which are always covariant)
  • It requires a different feature’s flag to work (it can be surprising that String? requires strict nullability if you don’t know the details)

And again, this is all to solve the issue that Options are not good enough because:

Of which the convenience argument can be addressed by two different, drastically simpler, proposals (the same I have already linked before: 1, 2)

And the efficiency aspect is, as far as I understand, really minor, and requires/causes some of the typing oddities above

4 Likes