Properties
Nick Sabalausky
a at a.a
Thu Jan 8 10:21:32 PST 2009
"Michiel Helvensteijn" <nomail at please.com> wrote in message
news:gk5f80$2lav$1 at digitalmars.com...
> Ary Borenszweig wrote:
>
>>>> It's very different. A setter has a very specific meaning: set some
>>>> value. That's why it's called "value". Another name could be the name
>>>> of
>>>> the property ("len") or something like "newLen". Which other name would
>>>> you use?
>>>
>>> It's not for me to say. It should be up to the programmer.
>>>
>>> You've already shown that there are at least three possibilities.
>>
>> Yes, three. And that's it. That was my point. And they all have pretty
>> much the same meaning.
>>
>> Well, unless you want to name it "nuevaLen", "novaLen", "nouvelleLen",
>> etc. :-P
>
> Perhaps the implicit declaration "value" (or whatever *you* would call it)
> inadvertently overshadows a member variable with that name. That could
> result in a bug that would be pretty hard to find.
>
Overshadowing is already a potential issue anyway, with or without
properties. Even a user-defined name could still accidentally overshadow
something. Also, using "$" could help minimize overshadowing, the only thing
that could ever clash with that is the "array.length" shorthand inside array
slices/indexes (and even that already has potential for clashing,
specifically when using nested indexes).
More information about the Digitalmars-d
mailing list