Nicolas Martyanoff on Nostr: Go has neither algebraic data type nor unions. So if you want to represent an IMF ...
Go has neither algebraic data type nor unions. So if you want to represent an IMF address which is either a mailbox or a group, you'll end up with an interface{} meaning you are losing type safety. The language is just not expressive enough to represent the problem space.
At least C had unions, this is clearly something it did better (and also const, enums…).
Published at
2024-01-28 14:55:14Event JSON
{
"id": "030789ee92d089ae7be4a63dc0f4df70e12443c88c22827f775321c7e19444de",
"pubkey": "f320bdda416aa99f2ae0949dca56c3bf58a9815c9de7ba950ad1fa568da2b816",
"created_at": 1706453714,
"kind": 1,
"tags": [
[
"proxy",
"https://emacs.ch/users/galdor/statuses/111834150618260241",
"activitypub"
]
],
"content": "Go has neither algebraic data type nor unions. So if you want to represent an IMF address which is either a mailbox or a group, you'll end up with an interface{} meaning you are losing type safety. The language is just not expressive enough to represent the problem space.\n\nAt least C had unions, this is clearly something it did better (and also const, enums…).",
"sig": "f84340dcd0c37e46194ebf255d5ceaafefa3a11f2f196827dfcdad44df997c6ac15d4bc27147c8a92c888e3e55b9297b7f7bf56716528620295be3ef0e7cbfde"
}