dmd 1.046 and 2.031 releases

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 7 13:17:59 PDT 2009


Jérôme M. Berger wrote:
> Andrei Alexandrescu wrote:
>> Jérôme M. Berger wrote:
>>>  - A floating point range should allow you to specify the iteration 
>>> step, or else it should allow you to iterate through all numbers that 
>>> can be represented with the corresponding precision;
>>
>> We don't have that, so you'd need to use a straigh for statement.
>>
> 
> struct FloatRange {
>    float begin, end, step;
>    bool includeBegin, includeEnd;
> 
>    int opApply (int delegate (ref float) dg) {
>       whatever;
>    }
> 
>    whatever;
> }
> 
>>>  - The second issue remains: what if I want to include b but not b+ε 
>>> for any ε>0?
>>
>> real a, b;
>> ...
>> for (real f = a; f <= b; update(f))
>> {
>> }
>>
>> I'd find it questionable to use ranged for with floats anyway.
>>
>     So would I. But a range of floats is useful for more than iterating 
> over it. Think interval arithmetic for example.

Cool. I'm positive that open ranges will not prevent you from 
implementing such a library (and from subsequently proposing it to 
Phobos :o)).


Andrei


More information about the Digitalmars-d-announce mailing list