[phobos] length implementation for Range

Masahiro Nakagawa repeatedly at gmail.com
Tue May 4 14:07:36 PDT 2010


Oh, I forgot D's history...


On Wed, 05 May 2010 04:31:51 +0900, David Simcha <dsimcha at gmail.com> wrote:

> Length should be a property.  When I filed my initial bug report, there  
> was
> no such thing as @property.  If that fixes this bug, them IMHO it's  
> fixed.
>
> On Tue, May 4, 2010 at 3:28 PM, Andrei Alexandrescu  
> <andrei at erdani.com>wrote:
>
>> I think the length should be a property.
>>
>> Andrei
>>
>>
>> Masahiro Nakagawa wrote:
>>
>>> Hi list,
>>>
>>> This post is my first post at Phobos ML :)
>>>
>>> I have one question about hasLength.
>>>
>>> Current implementation from std.range:
>>> -----
>>> template hasLength(R)
>>> {
>>>      enum bool hasLength = is(typeof(R.init.length) : ulong) &&
>>>          !isNarrowString!R;
>>> }
>>> -----
>>> This implementation has following issues.
>>>
>>> http://d.puremagic.com/issues/show_bug.cgi?id=2873
>>> http://d.puremagic.com/issues/show_bug.cgi?id=3508
>>>
>>> But, hasLength returns true when length method is marked as @property.
>>>
>>> We should fix the above issue or length method should be marked as
>>> @property?
>>> If latter, some ranges in phobos are incomplete.
>>> _______________________________________________



More information about the phobos mailing list