14752

Why is the name of an object type different from the name of the class it belongs to?

Question:

I am currently reading Chapter 9 in <a href="http://amzn.com/0387759352" rel="nofollow">Chambers' <em>Software for Data Analysis</em></a>, and on page 337, he says:

<blockquote>

In contrast, there are some inherent restrictions on the classe in the contains= argument. Classes supplied here must be either:

<ol><li>... <br /></li> <li>One of the basic R object types, but not those types that are references or nonstandard; for example, not "environment" <strong>or "symbol" (the object type for class "name")</strong>.</li> </ol></blockquote>

where the emphasis is mine.

My naive question is, why is the name of the object type (symbol) different from the class name (name)? This clashes with my understanding of an object as an instance of a class. Are there any other such examples, and how should I think about the naming convention here?

Answer1:

I see that as preventing you from constructing or requiring another level of indirection. The interpreter can assumed to be able to handle predefined object types in the 'contains' specification but not to be able to handle types that are more flexible or would require looking up what was in the value that was passed to it. A "symbol" is a way of finding something rather than the "something" itself.

R has both "storage modes" and "types" in addition to "modes" and "classes":

> x=as.name('y') > x y > mode(x) [1] "name" > class(x) [1] "name" > typeof(x) [1] "symbol" > storage.mode(x) [1] "symbol"

Recommend

  • How can find using c-program whether my machine is 16-bit or 32-bit or 64-bit
  • Class to store multiple comparators
  • Border width to change as per the inner div content width
  • mySQL CAST and ASC / DESC
  • Sample code to fix this particular SQL-injection hole
  • Forcing variable to reassign (Prolog)
  • Is there a list of URL schemes?
  • Is this prime generator inefficient C++?
  • How to replace a decimal in a number with a string?
  • How can I pass complex expression to parametrized active pattern?
  • Installing ocropus-0.4.4
  • Simple Factory with reflection C#
  • Pointer vs Reference difference when passing Eigen objects as arguments
  • LNK1104: cannot open file 'kernel32.lib'
  • Why isn't my “Fizz Buzz” test in R working?
  • Python PIL to extract number from image
  • Can my PDF ping my server when it is opened?
  • How to skip require in ruby?
  • CodeIgniter URI Parameter is partially bypassing an “if” statement
  • opencv display image without x server
  • Saving image to sd with current date and time in name doesn't work
  • Pycharm: Marking a folder as 'sources root' is not recursive for subfolders
  • Function calls are not supported. Consider replacing the function or lambda with a reference to an e
  • Cast between interfaces whose interface signatures are same
  • How to revert to previous XCode version?
  • Blackberry - Custom EditField Cursor
  • Content-Length header not returned from Pylons response
  • Yii2: Config params vs. const/define
  • C++ Partial template specialization - design simplification
  • Ajax Loaded meta Tags
  • Xamarin Forms - UWP Fonts
  • Javascript simulate pressing enter in input box
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • 0x202A in filename: Why?
  • AT Commands to Send SMS not working in Windows 8.1
  • Arrays break string types in Julia
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How do I configure my settings file to work with unit tests?
  • Is it possible to post an object from jquery to bottle.py?