Re:Three Months of Go from a Haskeller’s perspective (2016)
by lmm on Wednesday November 04, 2020 @02:32AM
(#24987051)
> The problem with "Make it an error to not initialise a struct field" is you lose source compatibility when adding new struct fields.
If you allow the struct definition to specify a default value then the struct author can set default in the cases where there is a sensible default, and leave it compile-time incompatible in the cases where there really is no good default and the person doing the upgrade needs to make a decision.
Re:Three Months of Go from a Haskeller’s perspective (2016)
by Cthulhu_ on Wednesday November 04, 2020 @07:42AM
(#24988472)
That is already possible by exposing a `New` function and making the struct itself unexposed; are you suggesting syntax should be added to provide default values to struct fields? Because there is high resistance (which I agree with btw) to adding additional syntax and constructs to the language.
Re:Three Months of Go from a Haskeller’s perspective (2016)
by lmm on Wednesday November 04, 2020 @08:22PM
(#24994815)
> That is already possible by exposing a `New` function and making the struct itself unexposed;
I thought Go didn't allow functions with default argument values either?
Re:Three Months of Go from a Haskeller’s perspective (2016)
by throw_m239339 on Tuesday November 03, 2020 @10:41PM
(#24986314)
Still no official debugger though. Delve is just full of bugs.
Re:Three Months of Go from a Haskeller’s perspective (2016)
by justasitsounds on Tuesday November 03, 2020 @10:46PM
(#24986329)
Just do as the Head of Marketing from previousEmployer suggested and "leave out the bugs"
Re:Three Months of Go from a Haskeller’s perspective (2016)
by lostcolony on Tuesday November 03, 2020 @10:51PM
(#24986340)
Revolutionary thinking right there
Re:Three Months of Go from a Haskeller’s perspective (2016)
by redis_mlc on Wednesday November 04, 2020 @03:27AM
(#24987289)
That's next-level.
Was he being ironic, or serious? Love to hear more.
Re:Three Months of Go from a Haskeller’s perspective (2016)
by AnimalMuppet on Wednesday November 04, 2020 @12:14PM
(#24990922)
"Head of Marketing". He was probably serious.
Re:Three Months of Go from a Haskeller’s perspective (2016)
by peter_l_downs on Tuesday November 03, 2020 @11:57PM
(#24986520)
delve (through vscode-go) has worked fine from my perspective
The versioning and slice sorting have since been solved, by go.mod and sort.Slice respectively.
The problem with "Make it an error to not initialise a struct field" is you lose source compatibility when adding new struct fields.