Thread overview
[phobos] length implementation for Range
May 04, 2010
Masahiro Nakagawa
May 04, 2010
David Simcha
May 04, 2010
Masahiro Nakagawa
May 04, 2010
Masahiro Nakagawa
May 04, 2010
Masahiro Nakagawa
May 04, 2010
Brad Roberts
May 05, 2010
Masahiro Nakagawa
May 05, 2010
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.
May 04, 2010
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
May 04, 2010
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.
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100504/96009068/attachment.html>
May 05, 2010
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.

May 05, 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.
>>> _______________________________________________

May 04, 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
May 05, 2010
http://www.dsource.org/projects/phobos/changeset/1495 Committed.


On Wed, 05 May 2010 06:32:46 +0900, Andrei Alexandrescu <andrei at erdani.com> wrote:

> 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
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

May 04, 2010
Don't forget to update the changelog, noting the issue number if there is one.  They're located in the phobos project.

On Wed, 5 May 2010, Masahiro Nakagawa wrote:

> Date: Wed, 05 May 2010 07:06:56 +0900
> From: Masahiro Nakagawa <repeatedly at gmail.com>
> Reply-To: Discuss the phobos library for D <phobos at puremagic.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Subject: Re: [phobos] length implementation for Range
> 
> http://www.dsource.org/projects/phobos/changeset/1495 Committed.
> 
> 
> On Wed, 05 May 2010 06:32:46 +0900, Andrei Alexandrescu <andrei at erdani.com> wrote:
> 
> > 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
> > _______________________________________________
> > phobos mailing list
> > phobos at puremagic.com
> > http://lists.puremagic.com/mailman/listinfo/phobos
> 
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
May 05, 2010
Thanks for your advice.

changeset 1495 isn't bug fixing, so I listed the summery at the WHATSNEW section.


On Wed, 05 May 2010 08:17:11 +0900, Brad Roberts <braddr at puremagic.com> wrote:

> Don't forget to update the changelog, noting the issue number if there is one.  They're located in the phobos project.
>
> On Wed, 5 May 2010, Masahiro Nakagawa wrote:
>
>> Date: Wed, 05 May 2010 07:06:56 +0900
>> From: Masahiro Nakagawa <repeatedly at gmail.com>
>> Reply-To: Discuss the phobos library for D <phobos at puremagic.com>
>> To: Discuss the phobos library for D <phobos at puremagic.com>
>> Subject: Re: [phobos] length implementation for Range
>>
>> http://www.dsource.org/projects/phobos/changeset/1495 Committed.
>>
>>
>> On Wed, 05 May 2010 06:32:46 +0900, Andrei Alexandrescu
>> <andrei at erdani.com>
>> wrote:
>>
>> > 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.