Re: [Rd] The default behaviour of a missing entry in an environment

2009-11-13 Thread Trishank Karthik Kuppusamy
Hello Henrik, On Nov 13, 2009, at 3:42 PM, Henrik Bengtsson wrote: > If you develop your own code you can add your own behavior by > "extending" the environment class. I put "extending" in quotation > marks, because 'environment' is one of few classes you should *not* > extend from in the regula

Re: [Rd] The default behaviour of a missing entry in an environment

2009-11-13 Thread Trishank Karthik Kuppusamy
On Nov 13, 2009, at 2:47 PM, Duncan Murdoch wrote: > Inconsistent with what happens for lists: > > > x <- list() > > x$b > NULL > > and attributes: > > > attr(x, "b") > NULL Ah, I see. I would claim that the same argument for default safety should apply here too. > It is already a little st

Re: [Rd] The default behaviour of a missing entry in an environment

2009-11-13 Thread Trishank Karthik Kuppusamy
Hello Duncan, Thanks for your reply. On Nov 13, 2009, at 2:27 PM, Duncan Murdoch wrote: > You get the same behaviour when asking for a nonexistent element of a list, > or a nonexistent attribute. If you want stricter checking, don't use $, use > get(): > > > get("b", e) > Error in get("b",

[Rd] The default behaviour of a missing entry in an environment

2009-11-13 Thread Trishank Karthik Kuppusamy
Greetings everyone, I have a question about the default behaviour of a missing entry in an environment. Let us look at the following sequence of R statements: > e <- new.env() > e$a <- 1 > e$a [1] 1 > e$b NULL > I think I understand the logic for returning NULL to a missing entry in an enviro