> This semantic difference is deeper than the subtleties of variadic
> argument passing, which are really only implementation details.

It's a bit more than an implementation detail, considering this somewhat obscure and surprising behaviour.
https://go.dev/play/p/xnGqtYansHY

On 8/17/25 23:34, 'Dan Kortschak' via golang-nuts wrote:
On Sun, 2025-08-17 at 05:36 -0700, Ruslan Semagin wrote:
`ch <- xs...` is a similar case: the semantics are well-defined
(element-wise dispatch with the usual channel behavior of
blocking/closing), backwards compatible, and optional. Those who
prefer an explicit loop can continue to write it, while others can
use a more concise form that does not introduce ambiguity.

In the comments on GitHub, it was also noted that it would be
possible to support `ch <- 1, 2, 3` (link)

Having the send expressible like this would allow it to be included in
a select. This has significant semantic complications. What is the
behaviour of select {; case ch <- 1, 2:; default: }? Does is require
that all sends succeed? What happens if it gets through n-1 of the
sends and the last one blocks?

This semantic difference is deeper than the subtleties of variadic
argument passing, which are really only implementation details.


--
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/a5704292-09aa-4734-beb6-e9e936dac287%40gmail.com.

Reply via email to