[Rd] Feature request: Allow comma after last element in a list
Mossa Merhi Reimert
tpb398 @end|ng |rom @|umn|@ku@dk
Fri May 1 20:00:56 CEST 2026
Thank you Ivan for your comments. I am going to think about it.
Also Duncan Murdoch, thank you very much for your comments.
I didn't know about nargs. here's what I learned:
> (function(...) {nargs()})()
[1] 0
> (function(...) {nargs()})(,)
[1] 2
> (function(...) {nargs()})(,,)
[1] 3
> (function(...) {nargs()})(,,,)
[1] 4
> (function(...) {nargs()})(,,,,)
[1] 5
> (function(...) {nargs()})(,,,,,)
[1] 6
Let me think about that.
And avi.e.gross: I am sorry man, I didn't finish my reply properly, and I still don't get what you're saying. If you see me in the real world, let's talk, in a slow way, so that we can understand
and empathize with each other. I just don't get it on text, it seems.
Sent from Outlook for Mac
From: avi.e.gross using gmail.com <avi.e.gross using gmail.com>
Date: Friday, 1 May 2026 at 19.40
To: Mossa Merhi Reimert <tpb398 using alumni.ku.dk>; 'Tomek Gieorgijewski' <cybergeorge2020 using gmail.com>; 'Duncan Murdoch' <murdoch.duncan using gmail.com>
Cc: r-devel using r-project.org <r-devel using r-project.org>
Subject: RE: [Rd] Feature request: Allow comma after last element in a list
Whether a change is easy or hard to make is an issue that can allow YOU to download the source code and make your own modified copy of R for your own use, Mossa. And, any code you then run under your version of R, will not necessarily be something you can share with others who want to run it under a more standard shared version in which it will not cause errors.
There is an implicit contract that people have with whoever works on the public version of R. That contract requires discussions and feedback on bug fixes, new features or changes in how a feature works. It requires careful documentation and often some level of testing to see who might be impacted and time to update their code so it keeps working. For truly optional features, it is often done over time. And, some old features are merely deprecated for a while before being removed.
Another language, called Python, decide to make some incompatible changes while people were using a version I will call 2.X and named the new version 3.0 and people who did not change their code were left with partial support in 2.X that was slated to end after a while. You could argue that this was a good choice in the long run.
R has tried to remain with one unified set of users and not ruin things, ot at least provide another easy migration route.
The fact that so many packages are created is not a negative but a feature of a language that allows and supports extensions while leaving the main body of common code reasonable.
And, as noted, not everyone sees allowing a dangling comma as a positive. The workarounds here are s simple as using NULL as a placeholder or using some package to create vectors and so on.
But, if R is not to your taste, fine. There are many other languages available and many of us here also use other languages depending on needs and circumstances.
And, do note, R has some serious features that are quite different than something like Python that make it possible to do some things easier, and vice versa. This means that blindly copying a feature from another language is not always something trivial or even welcomed.
From: Mossa Merhi Reimert <tpb398 using alumni.ku.dk>
Sent: Friday, May 1, 2026 12:35 PM
To: avi.e.gross using gmail.com; 'Tomek Gieorgijewski' <cybergeorge2020 using gmail.com>; 'Duncan Murdoch' <murdoch.duncan using gmail.com>
Cc: r-devel using r-project.org
Subject: Re: [Rd] Feature request: Allow comma after last element in a list
Respectfully, this is really one of the strangest responses I've seen in my life.
rlang literally re-invents R in 25k LOC of R code.. what other language has dialects written in its own language, and quite popular at that? It is getting to a level of absurdity, that I am not sure
how anyone can defend at this point.
If adding dangling commas is a hard, demanding, engineering problem, then I guess someone has to take a serious look at the code base. I might want to interject myself here, and say, it's not hard.
There are important things that need to be done. A GC lock available through C-API.
Making the r runtime reentrant, instead this process wide mayhem that exists. `[`(,,drop=FALSE). Dropping libtool from the configure scripts, so things can build,
without checks that don't are not important anymore. Some sort of tracking of heap-allocation
so R instrumentation tools are not seeing half the situation. I don't know.. there's just much more that actually needs scoping, planning and evaluation.
Sent from Outlook for Mac
From: avi.e.gross using gmail.com<mailto:avi.e.gross using gmail.com> <avi.e.gross using gmail.com<mailto:avi.e.gross using gmail.com>>
Date: Friday, 1 May 2026 at 14.48
To: Mossa Merhi Reimert <tpb398 using alumni.ku.dk<mailto:tpb398 using alumni.ku.dk>>; 'Tomek Gieorgijewski' <cybergeorge2020 using gmail.com<mailto:cybergeorge2020 using gmail.com>>; 'Duncan Murdoch' <murdoch.duncan using gmail.com<mailto:murdoch.duncan using gmail.com>>
Cc: r-devel using r-project.org<mailto:r-devel using r-project.org> <r-devel using r-project.org<mailto:r-devel using r-project.org>>
Subject: RE: [Rd] Feature request: Allow comma after last element in a list
I find the attitude a bit disturbing that a carefully designed and altered language be changed just because and without serious consideration. Who will fund it if volunteers do not step forward is one example of a serious consideration. What other changes should be put off to make room?
The default for many years in computing in general, IMO, was that a dangling comma probably represented an error where a programmer had forgotten to add another item. Dangling commas were not only allowed but required in some cases like argument lists to a function with 5 required positional arguments in some cases given how things were done and adding yet another dangling comma would have represented a problem as it now would have six arguments.
Things have changed and perhaps many or all languages will eventually allow dangling commas in some situations. But on the hierarchy of needs, some may see other updates for R as a bit more needed and compelling. Look how long it took to reach adding a pipe feature that includes an aspect few enjoy using versus the other pipes that persist.
As for packages adjusting, I have no idea if many would have to, but you can be sure that if there is a problem, many won't adjust for some time and users might be left out in the cold or simply not be able to upgrade to the latest versions.
It is not a good idea to just do things.
Having said that, of course, it might be a nice thing to do once it has been properly evaluated. But it would not particularly improve my life as I am quite used to what it takes to edit a comma separated list without leaving dangling commas.
-----Original Message-----
From: R-devel <r-devel-bounces using r-project.org<mailto:r-devel-bounces using r-project.org>> On Behalf Of Mossa Merhi Reimert via R-devel
Sent: Friday, May 1, 2026 2:52 AM
To: Tomek Gieorgijewski <cybergeorge2020 using gmail.com<mailto:cybergeorge2020 using gmail.com>>; Duncan Murdoch <murdoch.duncan using gmail.com<mailto:murdoch.duncan using gmail.com>>
Cc: r-devel using r-project.org<mailto:r-devel using r-project.org>
Subject: Re: [Rd] Feature request: Allow comma after last element in a list
Honestly, I think R just needs to add these things. I don't know what the hold out is.
It seems so odd, not to just move on from this lack of last-element-comma.
`[`(drop=FALSE) should also be adopted.
Why can't R have these things? CRAN has no package versioning at all. All CRAN packages
can be adjusted to the change, and it would be all good.
Sent from Outlook for Mac
From: R-devel <r-devel-bounces using r-project.org<mailto:r-devel-bounces using r-project.org>> on behalf of Tomek Gieorgijewski <cybergeorge2020 using gmail.com<mailto:cybergeorge2020 using gmail.com>>
Date: Thursday, 30 April 2026 at 21.36
To: Duncan Murdoch <murdoch.duncan using gmail.com<mailto:murdoch.duncan using gmail.com>>
Cc: Manfred Kooistra <manfred.kooistra using gmail.com<mailto:manfred.kooistra using gmail.com>>; r-devel using r-project.org<mailto:r-devel using r-project.org> <r-devel using r-project.org<mailto:r-devel using r-project.org>>
Subject: Re: [Rd] Feature request: Allow comma after last element in a list
Thank you for the link - definitely worth trying!
T.
czw., 30 kwi 2026 o 21:24 Duncan Murdoch <murdoch.duncan using gmail.com<mailto:murdoch.duncan using gmail.com>>
napisa�(a):
>
> This is a great suggestion. BTW, I think it would be possible to do
> this in RStudio as well. See their Addins page here:
> https://rstudio.github.io/rstudioaddins/<https://rstudio.github.io/rstudioaddins/> .
>
> Duncan Murdoch
>
> On 2026-04-30 1:44 p.m., Tomek Gieorgijewski wrote:
> > Hi Manfred!
> >
> > As I can see that you already maintain the habit to have one element per
> > line,
> > I would like to propose that you incorporate some editing scripts in your
> > editor
> > to help ease your frustration.
> > I believe trying to change R parser will only add more of that feeling :)
> > I don't know your editor but if it's vim, I can propose this edit to
> .vimrc
> > file:
> > " ----
> > function! ListCommas() range
> > if a:firstline < a:lastline
> > " Add commas at the end from first to second to last line if
> > there's no comma yet
> > execute a:firstline . "," . (a:lastline - 1) . 's/[^,]$/&,/e'
> > endif
> > " Delete comma from last line (if matched)
> > execute a:lastline . 's/,$//e'
> > endfunction
> >
> > vnoremap <leader>, :call ListCommas()<CR>
> > " ---
> >
> > So, now if you rerun vim on your file you can swap, add, delete lines
> from
> > the list as you wish,
> > and at the end you can highlight all elements lines of your list in
> visual
> > mode and execute ListCommas
> > function on those lines with <leader>, shortcut.
> >
> > Of course only if you maintain your structure of element per line and
> > trailing parenthesis at a seperate line.
> >
> > I'm sure VS Code, Emacs and some other editors have similar abilities to
> > help you.
> > Unfortunately I don't know of any such possibility in RStudio.
> >
> > regards,
> > Tomek.
> >
> > pt., 24 kwi 2026 o 13:35 Manfred Kooistra <manfred.kooistra using gmail.com<mailto:manfred.kooistra using gmail.com>>
> > napisa�(a):
> >
> >> I've always been irritated that R doesn't allow a comma after the last
> >> element in a "list":
> >>
> >>> a <- c(
> >> + 1,
> >> + 2,
> >> + 3
> >> + )
> >>> a
> >> [1] 1 2 3
> >>> b <- c(
> >> + 1,
> >> + 2,
> >> + 3,
> >> + )
> >> Error in c(1, 2, 3, ) : argument 4 is empty
> >>
> >> This makes updating lists unnecessarily cumbersome, which I find I
> >> frequently do, either when I test code and want to run it with lists of
> >> varying elements or varying orders of elements or when I maintain lists
> >> manually over time and have to add or delete elements from them.
> >>
> >> Is there a reason for this behavior in R and might it not be a good idea
> >> to change it?
> >> ______________________________________________
> >> R-devel using r-project.org<mailto:R-devel using r-project.org> mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-devel<https://stat.ethz.ch/mailman/listinfo/r-devel>
> >>
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-devel using r-project.org<mailto:R-devel using r-project.org> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel<https://stat.ethz.ch/mailman/listinfo/r-devel>
>
>
[[alternative HTML version deleted]]
______________________________________________
R-devel using r-project.org<mailto:R-devel using r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel<https://stat.ethz.ch/mailman/listinfo/r-devel>
[[alternative HTML version deleted]]
[[alternative HTML version deleted]]
More information about the R-devel
mailing list