Re: Array and Enum: Elements or Objects?
Hugh Sasse <[email protected]> Fri, 13 May 2011 17:41:48 +0100 (BST)
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 13 May 2011, Gary Wright wrote:
>
> On May 13, 2011, at 11:45 AM, Hugh Sasse wrote:
>
> > Before you put this work in, I'd be inclined to ask: why is this a problem?
> > Are you seeing some possible form of confusion? Just reading this paragraph
> > and not refreshing my memory of the docs, I'd tend to only distinguish between
> > elements and objects for things like Array#uniq where non-nil elements are
> > objects. Otherwise, a variety of word use tends to make English flow better.
> > Why does English have another word for "walrus"? Searching for
> > synonyms improve writing
> > produces a lot of relevant results. Repetitive word choice seems to be
> > widely considered a fault.
>
> Consistency is very important in technical documentation. Using synonyms introduces ambiguity because it often isn't clear when the synonym is being used for no particular reason or when it is being used to indicate a distinctly different technical meaning.
Agreed, and that's why I asked about cases where confusion is arising.
>
> That being said, I think 'element' is an appropriate term to use when referring to an object stored in a container of some sort. Using 'element' emphasizes the context. So when referring to the container/containee role 'element' is appropriate but when the container/containee role is irrelevant, then 'object' is OK. So I would encourage the use of both terms as long as the usage is consistent and not just reflective of different authors choices.
Agreed.
>
> I also think it is completely appropriate to refer to 'nil' as an object. Everything that has methods is an object in Ruby: nil, true, false, fixnum, symbols, etc. I know that some people like to introduce a dichotomy between objects that can be referenced with syntactical sugar and those that can't but I think that just confuses things.
This paragraph would have been unnecessary if you had not trimmed my last
sentence! :-) It does carry semantics of being nothing, so it is legitimate
to regard it as a non-object in cases where that applies such as uniq. I
still had to use the term non-nil to make this distinction apparent, because
it is an object with a class and methods.
>
> Gary Wright
>
Hugh