Skip to content
Prev 61441 / 63421 Next

Multiple Assignment built into the R Interpreter?

On Sat, 11 Mar 2023 11:11:06 -0500
Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

            
How about reframing this feature request from multiple assignment
(which does go contrary to "everything has only one value, even if it's
sometimes invisible(NULL)") to "structured binding" / "destructuring
assignment" [*], which takes this single single value returned by the
expression and subsets it subject to certain rules? It may be easier to
make a decision on the semantics for destructuring assignment (e.g.
languages which have this feature typically allow throwing unneeded
parts of the return value away), and it doesn't seem to break as much
of the rest of the language if implemented.

I see you've already mentioned it ("JavaScript-like"). I think it would
fulfil Sebastian's requirements too, as long as it is considered "true
assignment" by the rest of the language.

The hard part is to propose the actual grammar of the new feature (in
terms of src/main/gram.y, preferably without introducing conflicts) and
its semantics (including the corner cases, some of which you have
already mentioned). I'm not sure I'm up to the task.

Thread (22 messages)

Sebastian Martin Krantz Multiple Assignment built into the R Interpreter? Mar 11 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 11 Sebastian Martin Krantz Multiple Assignment built into the R Interpreter? Mar 11 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 11 Ivan Krylov Multiple Assignment built into the R Interpreter? Mar 11 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 11 Sebastian Martin Krantz Multiple Assignment built into the R Interpreter? Mar 11 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 11 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 11 Gabriel Becker Multiple Assignment built into the R Interpreter? Mar 11 Kevin Ushey Multiple Assignment built into the R Interpreter? Mar 11 @vi@e@gross m@iii@g oii gm@ii@com Multiple Assignment built into the R Interpreter? Mar 11 Sebastian Martin Krantz Multiple Assignment built into the R Interpreter? Mar 11 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 12 Sebastian Martin Krantz Multiple Assignment built into the R Interpreter? Mar 12 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 12 Sebastian Martin Krantz Multiple Assignment built into the R Interpreter? Mar 12 Pavel Krivitsky Multiple Assignment built into the R Interpreter? Mar 12 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 13 Gabor Grothendieck Multiple Assignment built into the R Interpreter? Mar 13 Martin Maechler Multiple Assignment built into the R Interpreter? Mar 14 Duncan Murdoch Multiple Assignment built into the R Interpreter? Mar 14