[go-nuts] Re: inconsistent min max signatures with variadics

2025-01-20 Thread Benoît Marguerie
If I remember well, max(slice...) existed but not anymore: it disappeared with Go 1.21 I think. The idea was to force one element at least -> why not, that's the "min/max business" I may say. But the "unpacking" operator is a builtin and should be allowed for all func with a variadic input para

[go-nuts] Re: inconsistent min max signatures with variadics

2025-01-20 Thread Stephen Illingworth
Oh I see what you mean now. Should max(slice...) be allowed (ie. just the slice and no unary value) ? It would behave like slices.Max() I think. Maybe there is deep reason for not allowing but it would be nice to have for sure. On Monday, 20 January 2025 at 15:21:10 UTC Benoît Marguerie wrote:

[go-nuts] Re: inconsistent min max signatures with variadics

2025-01-20 Thread Benoît Marguerie
Hi Stephen, max(5,slice) has no sense by itself, I'm agree with you. But the issue is about max(5,*slice...*) which should accept the "unpacking" operation like the append function. I know there's a buildin type "Type" for append while the min/max functions use the Generic with the interface cm

[go-nuts] Re: inconsistent min max signatures with variadics

2025-01-20 Thread Stephen Illingworth
What value do you think should be returned for "max(5, slice)" ? On Monday, 20 January 2025 at 15:00:04 UTC Benoît Marguerie wrote: > Hi, > > Even if the spec precises : > > slice arguments are not permitted > > I wonder if there's any real technical reason to prohibit the use of the > slice var