Names with trailing question mark

Jesse Phillips jessekphillips+D at gmail.com
Tue Oct 4 09:18:57 PDT 2011


bearophile Wrote:

> contains?
> areInside ==> inside?
> 
> 
> I don't remember serious recent discussions here about that last form. Allowing a single trailing question mark in D names has some advantages:
> 
> 1) It gives a standard way to denote a predicate, so it becomes very easy to tell apart a predicate from other non predicate things.
> 
> 2) It allows for short names.
> 
> 3) A single question mark is easy and quick to write on most keyboards.
> 
> 4) It is used in other languages, as Ruby, and people seem to appreciate it.
> 
> 5) Its meaning is probably easy enough to understand and remember.

I don't think I like symbols in variable names. I'm not sure since I've never used such, but the only time I like the symbols is by itself and performing an operation.

    assert(√(25) == 5);

There are probably many exceptions within Unicode, but if it is used by the language I'll likely just be annoyed by it. Just my thought.


More information about the Digitalmars-d mailing list