Skip to content
Prev 15079 / 63421 Next

Environment with no parent?

Duncan Murdoch <murdoch@stats.uwo.ca> writes:
I'm fairly sure the answer is "nope".

It's been annoying me for years, for language aesthetic reasons
mostly, but also with some consideration of cases like yours, and I've
been on the brink of implementing a version where the base environment
was a true environment. Apart from the usual issue of "round tuits",
I was held back by the fact that one has to consider at least two things:

(a) efficiency. Is it expensive no longer to have the base functions
bound directly to their symbol? (My gut feeling is that with suitable
hashing and cacheing, the penalty is minimal.)

(b) you can *only* use get and simple variable retrieval in a non-base
environment with a NULL parent (eval(x <- 1, envir=foo) would give
'couldn't find function "<-"' or so). This could cause some confusion.