Re: Array and Enum: Elements or Objects?
Gary Wright <[email protected]> Fri, 13 May 2011 12:25:47 -0400
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <[email protected]> |
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=20 > synonyms improve writing > produces a lot of relevant results. Repetitive word choice seems to = be > widely considered a fault.=20 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. 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. 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. Gary Wright=