On Friday, January 21, 2022 at 11:25:13 PM UTC+1 Ian Lance Taylor wrote: > > Another issue is the implementation of AbsoluteDifference, in > golang.org/design/43651-type-parameters#absolute-difference. > > The code is invalid due to #45639, but I suspect that the suggestion to > use a struct > > > > type ComplexAbs[T OrderedNumeric] struct { X T } > > > > will not solve the problem. > > Moreover the code suggested in the issue: > > > > func (a ComplexAbs[T]) Abs() ComplexAbs[T] { d := > math.Hypot(float64(real(a.X)), float64(imag(a.X))) return > ComplexAbs[T](complex(d, 0)) } > > > > does not compile. > > Thanks, I'm going to leave this as is for now. 45639 is still open. > > However it is disallowed in go1.18. In #50790 there is an alternate working solution. Thanks Manlio
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d8b62735-595f-4be4-92a8-4d2a2f8fb4a3n%40googlegroups.com.