[phobos] length implementation for Range

Andrei Alexandrescu andrei at erdani.com
Tue May 4 14:32:46 PDT 2010


It is a bug, if you could fix that would be great. There are many places 
in which we don't use @property but we must.

Andrei

Masahiro Nakagawa wrote:
> I agree. But, length of some range objects in Phobos isn't a property.
> Is this a bug? If so, I will commit.
> 
> 
> On Wed, 05 May 2010 04:28:06 +0900, 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.
> 
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list