Post AavfYmpwWI49E9torA by dvim@mastodon.social
(DIR) More posts by dvim@mastodon.social
(DIR) Post #AavJu64S0OlByDRROC by alexelcu@social.alexn.org
2023-10-19T09:19:56Z
0 likes, 0 repeats
The battle of union types — untagged vs tagged. Fight:
(DIR) Post #AavMbqGmJa7Rc7C8UC by tabdulradi@mastodon.social
2023-10-19T09:50:14Z
0 likes, 0 repeats
@alexelcu I am still waiting for -Yexplicit-null becoming on by default to be able use Nullable in production https://github.com/tabdulradi/Nullable
(DIR) Post #AavNTWR8GlqBjxdOfQ by kenbot@hachyderm.io
2023-10-19T09:59:55Z
0 likes, 0 repeats
@alexelcu Either one where only one of them is expressible in the language
(DIR) Post #AavPSLHWSRqylKhkPo by alexelcu@social.alexn.org
2023-10-19T10:22:10Z
0 likes, 0 repeats
@tabdulradi Having untagged union types in Scala 3, but without -Yexplicit-nulls, is pointless IMO.I'm guessing it's one of those breaking changes that takes a while to settle.
(DIR) Post #AavQMK1EL8EF3wmFPs by alexelcu@social.alexn.org
2023-10-19T10:32:15Z
0 likes, 0 repeats
@kenbot Meh
(DIR) Post #AavQUaXWncHkcNpGqG by kenbot@hachyderm.io
2023-10-19T10:33:44Z
0 likes, 0 repeats
@alexelcu Hahaha thanks I hate it
(DIR) Post #AavfYmpwWI49E9torA by dvim@mastodon.social
2023-10-19T13:22:33Z
0 likes, 0 repeats
@alexelcu today I discovered that Roc lang (from creators of Elm) does not have `Option` type and instead it offers tagged unions for such use-case: https://github.com/roc-lang/roc/blob/main/FAQ.md#why-doesnt-roc-have-a-maybe-or-option-or-optional-type-or-null-or-nil-or-undefinedIt makes good sense when describing your app data model, but I am not sure if that would work nice for optional arguments to functions. I think that it suggests, that optional arguments should be avoided and such functions refactored.
(DIR) Post #Ab1RaDP4zvtfVCsfcu by alexelcu@social.alexn.org
2023-10-22T08:14:13Z
0 likes, 0 repeats
@fanf42 in top of the JVM it can't be as efficient due to A|Null being a supertype of A.For one because it avoids boxing, but it also has implications for API versioning, as changing from A|Null to A in covariance, or from A to A|Null in contravariance does not break compatibility. With tagged unions you can't get this, AFAIK, even if we aren't talking of the JVM.