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

From: Trishank Karthik Kuppusamy <tk47_at_nyu.edu>
Date: Fri, 13 Nov 2009 14:39:41 -0500

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", e) : object 'b' not found

Yes, this is a solution. However, if we agree that "$" is (as it should be) syntactic sugar for get(), then why do we have different behaviour for what should essentially be the same operations, albeit the former being easier to read and write than the latter? Or is my premise mistaken and that is the whole point of having "$" and get() which are not identical?

> But then it would be inconsistent with what it does in other situations.

I am afraid that I did not fully understand this point. What would the inconsistencies be in other situations?

-Trishank



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 13 Nov 2009 - 19:43:33 GMT

This archive was generated by hypermail 2.2.0 : Fri 13 Nov 2009 - 20:10:24 GMT