If your language has block expressions, why not use block expressions for all grouping! be free, parentheses! `{ x + 10 } * y`. parens can be unambiguously tuples, just like they always wanted.
@dotstdy I showed this to @ianh and he managed to temporarily convince me (without necessarily holding this opinion himself) that function calls and tuples should use `[...]` instead of `(...)`, and then `(...)` can be used for blocks, after which your same idea applies. Were Lisp M-expressions right all along?

@zwarich @ianh instead of using `[..]` for calls you can use the Lua trick of having functions accept an anonymous structure. `do_stuff { 1, 2, 3 }`

Thus `(..)` is grouping / block, `{..}` is a struct / tuple, and `[..]` is an array.

now we're cooking

@dotstdy @ianh Has any recent language adopted uncurried single arg style where product types are used for multiple args rather than implicit currying? I know that Swift originally started in this direction, but I forget the actual reason why they backed away from this. Can you refresh my memory, @joe ?

@zwarich @dotstdy @ianh @joe Related, but why isn't first class multiple return values a thing more often?

For example, the C++26 standard library has senders/receivers which essentially work via continuations, so you can write async functions that take N inputs and M outputs natively without resorting to tuples. You can even send outputs of different types without having to box them into a sum type (because they just statically dispatch to different overloads).

@foonathan @dotstdy @ianh @joe My guess has always been that first-class multiple return values are overlooked because tuples serve their use case fairly well. When I think of use cases for them, my mind always goes to alternate ABIs like returning bools in status flags, etc.
@zwarich @foonathan @dotstdy @ianh I’m finding that ownership and lifetime dependent values really stretch the equivocation between tuples and multiple values. a tuple of borrows can’t always be used as a borrowed tuple, for instance

@joe @foonathan @dotstdy @ianh I think most languages that would allow you to return borrows would let you also store them as struct fields, etc. and just add a borrowed pointer type, in which case you could just make a tuple of borrows. I guess you could take a purist "parameter modes" approach and define borrowed struct fields via parameter modes on the struct's constructor? However, I think it might be tricky to make this work well with generics.

Another place where a similar distinction comes up is in-place construction of return values. Rust doesn't have this, but I assume that some successor language will want this to support internal self-reference, e.g. for efficient containers with inline capacity

@zwarich @foonathan @dotstdy @ianh yeah return value emplacement was the other thing i had in mind where a tuple (in its naive unexploded representation) isn't the same thing as multiple values.

even with first-class borrows, the way swift tries to allow for tuples to be magically exploded and imploded by the implementation fights against the very concept of a borrow-of-tuple ever existing, since you really want a contiguous representation for that borrow to refer to

@joe @foonathan @dotstdy @ianh Another funny realization is that if all return values are returned by writing to a passed reference, then you could have functions with no actual return values and only out-params (with the appropriate pointer type that must be written before returning). It's the use of resources like registers (which may be implicitly used by other code in the function) that necessitates presenting a value at the point of return.

You could take this to the next level and actually have out-params that "steal" registers when written to, but at that point you're probably in meme language territory.

@zwarich @joe @foonathan @dotstdy @ianh My prediction is that at some point in the next 5 years this whole “systems language” fad will blow over as programmers get tired of constantly being forced to deal with value semantics and unique ownership, and they’re going to rediscover the simplicity and elegance of garbage collection with uniform tagged pointers, at which point they’ll give this paradigm some really dumb name and pretend it’s brand new
@slava @zwarich @joe @foonathan @dotstdy @ianh @wingo Honestly, damn I really hope so. While I’m obvs very glad Rust has got memory safety (and much more) into the systems languages space I’m less happy that it’s encouraged a whole lot of new software written in a language that is extremely low-level for the task it’s being used for. The next task is to convince programmers not to choose the thing that’s fastest, but the thing that’s fast enough for the task and easiest on our human noggins
@slava @zwarich @joe @foonathan @dotstdy @ianh @wingo (We could have had a memory safe rewrite of coreutils 15 years ago or more! Would garbage collection really cause a problem for the performance of ‘cp’ or ‘tee’‽)
@dpk @slava @joe @wingo the GC itself is probably the least of one's concerns in that space. Namely you really don't want that layer of applications to depend on a chonky language runtime.
@dotstdy @dpk @slava @joe @wingo how chonky is fil-c? my understanding is that it's designed to address this exact issue (by giving C a reasonably-lightweight GC'd runtime so it can be memory-safe without having to rewrite anything)
@ianh @dpk @slava @joe @wingo yea as long as you can tank the perf and memory, but fil-c didn't exist 15 years ago. I don't know there's much else in the same ballpark?