poll for properties

Bill Baxter wbaxter at gmail.com
Wed Jul 29 09:23:14 PDT 2009


On Wed, Jul 29, 2009 at 4:35 AM, Dimitar
Kolev<DimitarRosenovKolev at hotmail.com> wrote:
> Kagamin Wrote:
>
>> bearophile Wrote:
>>
>> > Dimitar Kolev:
>> > > None. I would call it isEmpty or isEmpty().
>> >
>> > This may interest Andrei: lot of people here (me too) seem to think that the name "isEmpty" is better than "empty" for that purpose.
>> >
>> The very properties discussion comes from D living in the context of C family languages and their good practices. Python somehow managed to rebel from those...
>
> The properties discussion arises from the people who can not think of good names for variables and functions.

Andrei decided to use empty over isEmpty because he wanted names as
short as possible for the fundamental ops for ranges.  It had nothing
to do with not being able "think of" isEmpty.  He thought of it and
rejected it as too cumbersome for this purpose.

And it shouldn't be particularly ambiguous if understood to be an
attribute of the range and not an action on the range.  Unfortunately
we have no way in the language to specify that distinction.

> So they get confused by things like empty. It should be isEmpty the state and empty the function then there will be no confusion which does what and people can finally realize that () are optional.

If you don't have dedicated property syntax, then I agree, you
probably should avoid the ambiguity and resort to isEmpty.


> This is just an example but good names are the reason for all this weirdness. Or bad names.

I think having dedicated property syntax makes it easier to choose
good names because there are fewer ambiguity landmines to watch out
for.

--bb



More information about the Digitalmars-d mailing list