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

2025-01-21 Thread Benoît Marguerie
ok. Thanks Ian and Dan for your explanations even if I understand that the reason is just an implementation reason which introduces a bias on unpacking operator (seperation of concern would have be great here I suppose but maybe less efficient). Le lundi 20 janvier 2025 à 23:54:43 UTC+1, Dan Ko

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

2025-01-20 Thread 'Dan Kortschak' via golang-nuts
Agreed. My understanding was that this was because the min and max functions get written as an unrolled set of cmp instructions, rather than as a loop, and while this was not included in the spec for obvious reasons, it is why the spec was written that way. Dan On Mon, 2025-01-20 at 14:35 -0800,

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

2025-01-20 Thread Ian Lance Taylor
On Mon, Jan 20, 2025 at 11:35 AM 'Dan Kortschak' via golang-nuts wrote: > > On Mon, 2025-01-20 at 10:42 -0800, Ian Lance Taylor wrote: > > Calling append with an empty slice is well defined. Calling min or > > max with an empty slice is not. > > If the only input to min/max were the slice, this wo

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

2025-01-20 Thread Benoît Marguerie
Thanks Ian and Dan for your returns. I'm pretty agree with Dan considering that if append can understand that an empty slice provides nothing to add, I think min/max should be able to understand that an empty slice provides nothing to compare to the first param. Moreover, today, it is possible

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

2025-01-20 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2025-01-20 at 10:42 -0800, Ian Lance Taylor wrote: > Calling append with an empty slice is well defined. Calling min or > max with an empty slice is not. If the only input to min/max were the slice, this would be true, but I do not think it is in the case that is implemented in the standar

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

2025-01-20 Thread Ian Lance Taylor
On Mon, Jan 20, 2025 at 7:00 AM Benoît Marguerie wrote: > > 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 variadics during min/max buildin functions, when it's allowed with > append (which cr

[go-nuts] inconsistent min max signatures with variadics

2025-01-20 Thread Benoît Marguerie
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 variadics during *min/max* buildin functions, when it's allowed with *append* (which creates inconsistent behavior between buildin functions)? Exam