[Rd] Feature request: Allow comma after last element in a list
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Fri May 1 19:06:09 CEST 2026
No, dangling commas wouldn't be hard to implement in base R, but they
would let errors slip through that are now caught. If you don't care
about that, simply implement the change yourself, or use one of the
contributed packages that does so.
The "drop=FALSE" option is the opposite: the current default lets
errors slip through, but it is convenient in most cases. The problem
with changing the default is that it would trigger thousands of errors
in packages that assume current behaviour.
I don't have an opinion on your other suggestions.
Duncan Murdoch
On 2026-05-01 12:35 p.m., Mossa Merhi Reimert wrote:
> 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 <avi.e.gross using gmail.com>
> *Date: *Friday, 1 May 2026 at 14.48
> *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
>
> 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> On Behalf Of Mossa Merhi
> Reimert via R-devel
> Sent: Friday, May 1, 2026 2:52 AM
> To: 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
>
> 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> on behalf of Tomek
> Gieorgijewski <cybergeorge2020 using gmail.com>
> Date: Thursday, 30 April 2026 at 21.36
> To: Duncan Murdoch <murdoch.duncan using gmail.com>
> Cc: Manfred Kooistra <manfred.kooistra using gmail.com>; 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
>
> Thank you for the link - definitely worth trying!
>
> T.
>
> czw., 30 kwi 2026 o 21:24 Duncan Murdoch <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://eur02.safelinks.protection.outlook.com/?
> url=https%3A%2F%2Frstudio.github.io%2Frstudioaddins%2F&data=05%7C02%7Ctpb398%40alumni.ku.dk%7Cae85de2ff156426ad76908dea77fdfb9%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C639132364817869564%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ojTec59KVitsio9CF5Rdt12f6NGoi8UDtbH2gpRxynY%3D&reserved=0 <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>
> > > 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 mailing list
> > >> https://eur02.safelinks.protection.outlook.com/?
> url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-
> devel&data=05%7C02%7Ctpb398%40alumni.ku.dk%7Cae85de2ff156426ad76908dea77fdfb9%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C639132364817892997%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=cl8Rb5YnKdIr0N6fptlbm9nEWqn9orcdzCaAnckSma0%3D&reserved=0 <https://stat.ethz.ch/mailman/listinfo/r-devel>
> > >>
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-devel using r-project.org mailing list
> > > https://eur02.safelinks.protection.outlook.com/?
> url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-
> devel&data=05%7C02%7Ctpb398%40alumni.ku.dk%7Cae85de2ff156426ad76908dea77fdfb9%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C639132364817907466%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=SW9ZtK6DaWGOaAifCCRti7ApVSyREXTB3DgeDwG5tA0%3D&reserved=0 <https://stat.ethz.ch/mailman/listinfo/r-devel>
> >
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://eur02.safelinks.protection.outlook.com/?
> url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-
> devel&data=05%7C02%7Ctpb398%40alumni.ku.dk%7Cae85de2ff156426ad76908dea77fdfb9%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C639132364817921020%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=NGvNN9dmg1qkKlDp0rJ2q7HCcLuUKDCZxrzOea%2BvRoA%3D&reserved=0 <https://stat.ethz.ch/mailman/listinfo/r-devel>
>
> [[alternative HTML version deleted]]
>
>
More information about the R-devel
mailing list