From minshall at acm.org  Tue Jul  8 16:05:03 2014
From: minshall at acm.org (Greg Minshall)
Date: Tue, 08 Jul 2014 17:05:03 +0300
Subject: [Rd] arguments to .Call(), .External should be read-only?
Message-ID: <82683.1404828303@greg-minshalls-mbp.local>

hi.  if i'm reading correctly, "Writing R Extensions" appears to be
inconsistent on the question of whether the arguments passed to a
routine called via .Call() or .External() should considered read-only.
section 5.2, "Interface functions .C and .Fortran", says
----
However, when character vectors are used other than in a read-only way,
the .Call interface is much to be preferred.
----

which sort of implies (if one reads optimistically) that using .Call()
(by extension, again optimistically, .External()) one could treat
*character* vectors (and, again, optimistically, numeric, etc., vectors)
in a non-read-only way.

on the other (pessimistic) hand, section 5.9, "Handling R objects in C",
says
----
Neither .Call nor .External copy their arguments: you should treat
arguments you receive through these interfaces as read-only.
----

for an application, i'd like to consider these writable.  assuming
sufficient warnings in the documentation, etc., is that permissable?

cheers, Greg Minshall



[Rd] arguments to .Call(), .External should be read-only?
Greg Minshall