static interface

Michel Fortin michel.fortin at michelf.com
Tue Nov 17 06:38:35 PST 2009


On 2009-11-17 09:12:04 -0500, "Lars T. Kyllingstad" 
<public at kyllingen.NOSPAMnet> said:

> That's why I mentioned infinite ranges. An infinite range is *defined* 
> as a range where empty is implemented as
> 
>    enum bool empty = false;
> 
> isInfinite(Range) tests whether this is the case, which it wouldn't be 
> able to do if empty() was a function.

Which makes me think: what about a range that can but may not 
necessarily be infinite depending on runtime parameters? For instance, 
you could have a range returning a rational number as decimal digits: 
some will be infinite and others will be finite depending on the 
rational number (like 1/3 vs. 1/4). You can't express that with an enum.

I guess you could fix that by overloading isInfinite for your specific 
range type though.

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




More information about the Digitalmars-d mailing list