Re:Go and Java: Rethinking Type Safety for the Pragmatic Age
by release-object on Tuesday November 26, 2024 @05:29PM
(#42250806)
> the language insists that anybody can conjure one into existence despite having no basis for doing so
You can have a goose (unepxorted) that is created via NewGoose() (exported - really a constructor). Of course within a package there is nothing to stop you doing the wrong thing. I really like Go. But I do find myself occasionally writing overly verbose types just to avoid this issue. Which, if I’m honest with myself, is a bit
silly.
There’s a good counter argument to using to unepxorted types like this below.
You can have a goose (unepxorted) that is created via NewGoose() (exported - really a constructor). Of course within a package there is nothing to stop you doing the wrong thing. I really like Go. But I do find myself occasionally writing overly verbose types just to avoid this issue. Which, if I’m honest with myself, is a bit silly.
There’s a good counter argument to using to unepxorted types like this below.
Shortcut: https://news.ycombinator.com/item?id=42250614