Maybe adding generics to Go is about syntax after all
dave.cheney.net
Maybe adding generics to Go is about syntax after all
1–10 of 92 posts
Re: Maybe adding generics to Go is about syntax after all
#2 if err != nil {
return errors.Wrap(err, "some message that is unique to this line")
}
and the handle construct doesn't really handle (excuse the pun) this properly (you have to re-define handle each time or have a local variable or something similar). Which means that the new construct won't actually be massively helpful unless the only thing you want to do is errors.WithStack or just bubble the error back up.But I do get why they couldn't get .map_err() -- because that's something you can only really do if you have a Result type.
Re: Maybe adding generics to Go is about syntax after all
#3Re: Maybe adding generics to Go is about syntax after all
#4Re: Maybe adding generics to Go is about syntax after all
#5and the future seems to be more weirdness. magic methods like handle. list comprehensions still uncertain. contracts sound like a backwards compatible break and duplicate of existing functionality.
i used go to use libraries and low memory foot print for my small projects. but i bet there’s simpler routes out there
Re: Maybe adding generics to Go is about syntax after all
#6Why not reuse Common Lisp macros?
Re: Maybe adding generics to Go is about syntax after all
#7 var _ SomeIface = SomeConcrete{}
var _ AnotherIface = SomeConcrete{}
Just to see if you actually implemented all the signatures on the interface correctly.Re: Maybe adding generics to Go is about syntax after all
#8On the topic of "syntax is important" (though not related to generics -- other than by aside to the Result type) I'm still not a huge fan of the handle syntax -- I reckon something more similar to Rust's .map_err() would be handled better because lots of people now use pkg/errors[1] which has the boilerplate of if err != nil { return errors.Wrap(err, "some message that is unique to this line") } and the handle constr…
Re: Maybe adding generics to Go is about syntax after all
#9On the topic of "syntax is important" (though not related to generics -- other than by aside to the Result type) I'm still not a huge fan of the handle syntax -- I reckon something more similar to Rust's .map_err() would be handled better because lots of people now use pkg/errors[1] which has the boilerplate of if err != nil { return errors.Wrap(err, "some message that is unique to this line") } and the handle constr…
C/C++ __LINE__ is unique to a line.
Re: Maybe adding generics to Go is about syntax after all
#10Why not reuse Common Lisp macros?