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 variadics during *min/max* buildin functions, when it's allowed 
> with *append* (which creates inconsistent behavior between buildin 
> functions)?
>
> Example:
> ```
> func main() {
> slice := []int{0, 1, 2, 3, 4, 5, 6, 7}
> padding := []int{8, 9}
>
> slice = append(slice, padding...)
> forbidden := max(5, slice...) //Doesn't build due to this line....
>
> fmt.Println(forbidden)
> }
> ```
> -> https://go.dev/play/p/pWzf9WKgW3q
>
>

-- 
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 visit 
https://groups.google.com/d/msgid/golang-nuts/08429a8d-b12e-48a7-b04d-f8852cb21d7dn%40googlegroups.com.

Reply via email to