Skip to content

Syntactically valid names

7 messages · Hadley Wickham, steven mosher, Peter Dalgaard

#
Good point.  Thanks!

Hadley
#
On Tue, Jul 5, 2011 at 7:31 PM, steven mosher <moshersteven at gmail.com> wrote:
Hmm, I think that suggests a couple of small bug in make.names:
[1] "..."
[1] "..1"

and
[1] TRUE


Hadley
#
On Jul 6, 2011, at 01:40 , Hadley Wickham wrote:

            
What's wrong with that? They are names alright, just with special meanings.
[1] "name"
Mildly insane, but technically OK, no?

  
    
#
But you can't really use them for variables:
Error: '...' used in an incorrect context
Error: 'nthcdr' needs a list to CDR down

And make.names generally protects you against that:
[1] "function."
[1] "break."
[1] "TRUE."
I don't think so:
Error in assign(x, 1) : variable names are limited to 10000 bytes

Hadley
#
On Jul 6, 2011, at 03:25 , Hadley Wickham wrote:

            
That's two different issues:
Error: unexpected 'break' in "y$break"

Notice that there is nothing _syntactically_ wrong with ... & friends as names:
... <- 4

It's the _evaluator_ that throws the error because the ...-name has a special interpretation.
But that's a sanity check, with an arbitrary cutoff.  A string of a million "x"s is syntactically a valid name, it's just the evaluator that refuses to play with it. (Not to say that it would be wrong to put in a similar sanity check in make.names.)
#
Oh good point.  Thanks for the clarification.

Hadley