The new, new phobos sneak preview

Michel Fortin michel.fortin at michelf.com
Mon Apr 13 02:19:03 PDT 2009


On 2009-04-13 03:56:11 -0400, Rainer Deyke <rainerd at eldwood.com> said:

> Michel Fortin wrote:
>> Which makes me think of one thing: why "isBounded" instead of plain and
>> simple "bounded"? Ranges don't respond to "isEmpty": they have "empty"
>> instead.
> 
> "bounded(x)" can be read as a predicate ("Is x bounded?"), an assertion
> ("x is bounded, so treat it as such.") or even a conversion (although I
> admit that I can think of a meaningful way to convert an unbounded
> sequence into a bounded sequence).  "isBounded(x)" is unambiguous.

I disagree. How adding the "is" it disambiguate between the predicate 
and the assertion? "x.isBounded" reads more like "x is bounded" (the 
assertion) than "is x bounded" (the predicate).

 * * *

Assuming the "is" form is less ambiguous for bounded, the same could be 
said about "empty". In fact, not putting "is" in front of "emtpy" is 
even worse since "empty" can also be a verb.

Predicate: "Is x empty?";
Assertion: "x is empty";
Verb: "empty x".

Anyway, more than advocating for or against the "is" prefix, I mostly 
want things to be coherent. If you use "is" for bounded, you should use 
"is" for empty too. That's why I'm suggesting there is a section about 
choosing names in Phobos' Naming Conventions.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list