Conversation

it does mean that you can now have a total of four sets of parens in a function def: func (type T) (s Foo*) Bar(arg1 Baz, arg2 Baz2) (bool, Quux)
1
3
My first instinct is to say "but those aren't the same thing!" but if it's a feature-for-feature trade I'd happily give up interfaces for tagged unions. Can always use records with functions in them instead, they're not even that bad to use.
2
I thought the issue was more that they started out with the assumption that everything needed a default value. Anyway, that means it's hard to have a default for tagged unions (which should have given them a hint that defaults for everything is kinda ick, but egh).
2
1
I'm _guessing_ because they were coming from a C perspective and wanted to ensure everything was zero initialised to start off with because it was safer. And then a whole tower of design decisions were built atop that.
2
Replying to
There are some practical advantages to having a fixed initial value like zero... mostly related to allocator optimizations, AFAIK. But of course if those aren't actually reasonable values and always get changed in practice these optimizations are worthless.
2
1
Yeah, I'm not sure if it's 'a fixed value' or just 'some default'. You might be right that there are optimization considerations built on top of there, but OCaml's pretty quick and it seems to do ok here... out of my depth here though 🤷‍♀️
1
Show replies