Thread overview
[phobos] phobos commit, revision 1678
Jun 22, 2010
dsource.org
Jun 22, 2010
Brad Roberts
Jun 22, 2010
David Simcha
Jun 22, 2010
Brad Roberts
Jun 22, 2010
Don Clugston
June 22, 2010
phobos commit, revision 1678


user: dsimcha

msg:
Bug 4362:  std.range.repeat and cycle do not have a .save() method

http://www.dsource.org/projects/phobos/changeset/1678

June 22, 2010
On 6/22/2010 5:31 AM, dsource.org wrote:
> phobos commit, revision 1678
> 
> 
> user: dsimcha
> 
> msg:
> Bug 4362:  std.range.repeat and cycle do not have a .save() method
> 
> http://www.dsource.org/projects/phobos/changeset/1678

Don't forget to add unit tests. :)
June 22, 2010
Realistically, how would you recommend testing something like this?  I checked to make sure that there was something instantiating each version of the structs to make sure that they compile (i.e. no silly syntax errors), and as for the logical correctness, it seemed like the code was so trivial that it would  be silly to write an explicit test for it.  Furthermore, the precedent in the rest of Phobos seems to be that such trivial code does not require testing.

On Tue, Jun 22, 2010 at 10:30 AM, Brad Roberts <braddr at puremagic.com> wrote:

> On 6/22/2010 5:31 AM, dsource.org wrote:
> > phobos commit, revision 1678
> >
> >
> > user: dsimcha
> >
> > msg:
> > Bug 4362:  std.range.repeat and cycle do not have a .save() method
> >
> > http://www.dsource.org/projects/phobos/changeset/1678
>
> Don't forget to add unit tests. :)
> _______________________________________________
> 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/20100622/0d44e71e/attachment.html>
June 22, 2010
I think just issuing an assert(isForwardRange!(typeof(repeat(1))) should suffice.

Andrei

On 06/22/2010 09:58 AM, David Simcha wrote:
> Realistically, how would you recommend testing something like this?  I checked to make sure that there was something instantiating each version of the structs to make sure that they compile (i.e. no silly syntax errors), and as for the logical correctness, it seemed like the code was so trivial that it would  be silly to write an explicit test for it. Furthermore, the precedent in the rest of Phobos seems to be that such trivial code does not require testing.
>
> On Tue, Jun 22, 2010 at 10:30 AM, Brad Roberts <braddr at puremagic.com <mailto:braddr at puremagic.com>> wrote:
>
>     On 6/22/2010 5:31 AM, dsource.org <http://dsource.org> wrote:
>      > phobos commit, revision 1678
>      >
>      >
>      > user: dsimcha
>      >
>      > msg:
>      > Bug 4362:  std.range.repeat and cycle do not have a .save() method
>      >
>      > http://www.dsource.org/projects/phobos/changeset/1678
>
>     Don't forget to add unit tests. :)
>     _______________________________________________
>     phobos mailing list
>     phobos at puremagic.com <mailto: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
June 22, 2010
Should all the ranges have that sort of static assert to make sure they satisfy the intended set of attributes?

On 6/22/2010 8:03 AM, Andrei Alexandrescu wrote:
> I think just issuing an assert(isForwardRange!(typeof(repeat(1))) should
> suffice.
> 
> Andrei
> 
> On 06/22/2010 09:58 AM, David Simcha wrote:
>> Realistically, how would you recommend testing something like this?  I checked to make sure that there was something instantiating each version of the structs to make sure that they compile (i.e. no silly syntax errors), and as for the logical correctness, it seemed like the code was so trivial that it would  be silly to write an explicit test for it. Furthermore, the precedent in the rest of Phobos seems to be that such trivial code does not require testing.
>>
>> On Tue, Jun 22, 2010 at 10:30 AM, Brad Roberts <braddr at puremagic.com <mailto:braddr at puremagic.com>> wrote:
>>
>>     On 6/22/2010 5:31 AM, dsource.org <http://dsource.org> wrote:
>>      > phobos commit, revision 1678
>>      >
>>      >
>>      > user: dsimcha
>>      >
>>      > msg:
>>      > Bug 4362:  std.range.repeat and cycle do not have a .save() method
>>      >
>>      > http://www.dsource.org/projects/phobos/changeset/1678
>>
>>     Don't forget to add unit tests. :)
>>     _______________________________________________
>>     phobos mailing list
>>     phobos at puremagic.com <mailto: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

June 22, 2010
Yes.

Andrei

On 06/22/2010 12:24 PM, Brad Roberts wrote:
> Should all the ranges have that sort of static assert to make sure they satisfy the intended set of attributes?
>
> On 6/22/2010 8:03 AM, Andrei Alexandrescu wrote:
>> I think just issuing an assert(isForwardRange!(typeof(repeat(1))) should
>> suffice.
>>
>> Andrei
>>
>> On 06/22/2010 09:58 AM, David Simcha wrote:
>>> Realistically, how would you recommend testing something like this?  I checked to make sure that there was something instantiating each version of the structs to make sure that they compile (i.e. no silly syntax errors), and as for the logical correctness, it seemed like the code was so trivial that it would  be silly to write an explicit test for it. Furthermore, the precedent in the rest of Phobos seems to be that such trivial code does not require testing.
>>>
>>> On Tue, Jun 22, 2010 at 10:30 AM, Brad Roberts<braddr at puremagic.com <mailto:braddr at puremagic.com>>  wrote:
>>>
>>>      On 6/22/2010 5:31 AM, dsource.org<http://dsource.org>  wrote:
>>>       >  phobos commit, revision 1678
>>>       >
>>>       >
>>>       >  user: dsimcha
>>>       >
>>>       >  msg:
>>>       >  Bug 4362:  std.range.repeat and cycle do not have a .save() method
>>>       >
>>>       >  http://www.dsource.org/projects/phobos/changeset/1678
>>>
>>>      Don't forget to add unit tests. :)
>>>      _______________________________________________
>>>      phobos mailing list
>>>      phobos at puremagic.com<mailto: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
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
June 22, 2010
I have a question.  When a template is used only for static checking, such as static asserts and template constraints, is it's typeinfo and paraphernalia included in the resulting executable?  I don't think it should be, otherwise bloat will ensue...

-Steve



----- Original Message ----
> From: Andrei Alexandrescu <andrei at erdani.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Sent: Tue, June 22, 2010 2:01:32 PM
> Subject: Re: [phobos] phobos commit, revision 1678
> 
> Yes.

Andrei

On 06/22/2010 12:24 PM, Brad Roberts wrote:
> 
> Should all the ranges have that sort of static assert to make sure they
> satisfy
> the intended set of attributes?
>
> On 6/22/2010 8:03 AM, Andrei Alexandrescu wrote:
>> I think just issuing an
> assert(isForwardRange!(typeof(repeat(1))) should
>> 
> suffice.
>>
>> Andrei
>>
>> On 06/22/2010
> 09:58 AM, David Simcha wrote:
>>> Realistically, how would you
> recommend testing something like this?  I
>>> checked to make
> sure that there was something instantiating each version
>>> of the
> structs to make sure that they compile (i.e. no silly syntax
>>> 
> errors), and as for the logical correctness, it seemed like the code was
>>> so trivial that it would  be silly to write an explicit
> test for it.
>>> Furthermore, the precedent in the rest of Phobos
> seems to be that such
>>> trivial code does not require
> testing.
>>>
>>> On Tue, Jun 22, 2010 at 10:30 AM, Brad
> Roberts<
> href="mailto:braddr at puremagic.com">braddr at puremagic.com
>>> 
> <mailto:
> href="mailto:braddr at puremagic.com">braddr at puremagic.com>>
> wrote:
>>>
>>>      On 6/22/2010 5:31 AM,
> 
> href="http://dsource.org">dsource.org<http://dsource.org> wrote:
>>>       >  phobos commit, revision
> 1678
>>>       >
>>> 
>    >
>>>       >  user:
> dsimcha
>>>       >
>>> 
>    >  msg:
>>>       >  Bug
> 4362:  std.range.repeat and cycle do not have a .save() method
>>>       >
>>> 
>    >
> http://www.dsource.org/projects/phobos/changeset/1678
>>>
>>> 
>     Don't forget to add unit tests. :)
>>> 
>   _______________________________________________
>>> 
>     phobos mailing list
>>> 
> ymailto="mailto:phobos at puremagic.com"
> href="mailto:phobos at puremagic.com">phobos at puremagic.com<mailto:
> ymailto="mailto:phobos at puremagic.com"
> href="mailto:phobos at puremagic.com">phobos at puremagic.com>
>>> 
> 
> http://lists.puremagic.com/mailman/listinfo/phobos
>>>
>>>
>>>
>>>
>>> 
> _______________________________________________
>>> phobos mailing
> list
>>> 
> href="mailto:phobos at puremagic.com">phobos at puremagic.com
>>> 
> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
> >http://lists.puremagic.com/mailman/listinfo/phobos
>> 
> _______________________________________________
>> phobos mailing
> list
>> 
> href="mailto:phobos at puremagic.com">phobos at puremagic.com
>> 
> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
> >http://lists.puremagic.com/mailman/listinfo/phobos
>
> 
> _______________________________________________
> phobos mailing
> list
> 
> href="mailto:phobos at puremagic.com">phobos at puremagic.com
> 
> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
> >http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos
> mailing list

> href="mailto:phobos at puremagic.com">phobos at puremagic.com

> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
> >http://lists.puremagic.com/mailman/listinfo/phobos



June 22, 2010
Good question. Only a couple of weeks ago I fixed a big object file bloat by moving stuff like this:

static assert(e1);
static assert(e2);
static assert(e3);

inside a unittest:

unittest
{
     static assert(e1);
     static assert(e2);
     static assert(e3);
}

I recall that the size of hello.o decreased from 30KB to 1.9KB.


Andrei

On 06/22/2010 01:10 PM, Steve Schveighoffer wrote:
> I have a question.  When a template is used only for static checking, such as static asserts and template constraints, is it's typeinfo and paraphernalia included in the resulting executable?  I don't think it should be, otherwise bloat will ensue...
>
> -Steve
>
>
>
> ----- Original Message ----
>> From: Andrei Alexandrescu<andrei at erdani.com>
>> To: Discuss the phobos library for D<phobos at puremagic.com>
>> Sent: Tue, June 22, 2010 2:01:32 PM
>> Subject: Re: [phobos] phobos commit, revision 1678
>>
>> Yes.
>
> Andrei
>
> On 06/22/2010 12:24 PM, Brad Roberts wrote:
>>
>> Should all the ranges have that sort of static assert to make sure they
>> satisfy
>> the intended set of attributes?
>>
>> On 6/22/2010
>> 8:03 AM, Andrei Alexandrescu wrote:
>>> I think just issuing an
>> assert(isForwardRange!(typeof(repeat(1))) should
>>>
>> suffice.
>>>
>>> Andrei
>>>
>>> On 06/22/2010
>> 09:58 AM, David Simcha wrote:
>>>> Realistically, how would you
>> recommend testing something like this?  I
>>>> checked to make
>> sure that there was something instantiating each version
>>>> of the
>> structs to make sure that they compile (i.e. no silly syntax
>>>>
>> errors), and as for the logical correctness, it seemed like the code was
>>>> so trivial that it would  be silly to write an explicit
>> test for it.
>>>> Furthermore, the precedent in the rest of Phobos
>> seems to be that such
>>>> trivial code does not require
>> testing.
>>>>
>>>> On Tue, Jun 22, 2010 at 10:30 AM, Brad
>> Roberts<
>> href="mailto:braddr at puremagic.com">braddr at puremagic.com
>>>>
>> <mailto:
>> href="mailto:braddr at puremagic.com">braddr at puremagic.com>>
>> wrote:
>>>>
>>>>       On 6/22/2010 5:31 AM,
>>
>> href="http://dsource.org">dsource.org<http://dsource.org> wrote:
>>>>        >   phobos commit, revision
>> 1678
>>>>        >
>>>>
>>     >
>>>>        >   user:
>> dsimcha
>>>>        >
>>>>
>>     >   msg:
>>>>        >   Bug
>> 4362:  std.range.repeat and cycle do not have a .save()
>> method
>>>>        >
>>>>
>>     >
>> http://www.dsource.org/projects/phobos/changeset/1678
>>>>
>>>>
>>      Don't forget to add unit tests. :)
>>>>
>>    _______________________________________________
>>>>
>>      phobos mailing list
>>>>
>> ymailto="mailto:phobos at puremagic.com"
>> href="mailto:phobos at puremagic.com">phobos at puremagic.com<mailto:
>> ymailto="mailto:phobos at puremagic.com"
>> href="mailto:phobos at puremagic.com">phobos at puremagic.com>
>>>>
>>
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>>>
>>>>
>>>>
>>>>
>>>>
>> _______________________________________________
>>>> phobos mailing
>> list
>>>>
>> href="mailto:phobos at puremagic.com">phobos at puremagic.com
>>>>
>> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>>>
>> _______________________________________________
>>> phobos mailing
>> list
>>>
>> href="mailto:phobos at puremagic.com">phobos at puremagic.com
>>>
>> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
>>
>> _______________________________________________
>> phobos mailing
>> list
>>
>> href="mailto:phobos at puremagic.com">phobos at puremagic.com
>>
>> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
>>> http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos
>> mailing list
>
>> href="mailto:phobos at puremagic.com">phobos at puremagic.com
>
>> href="http://lists.puremagic.com/mailman/listinfo/phobos" target=_blank
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
June 22, 2010
On 22 June 2010 20:24, Andrei Alexandrescu <andrei at erdani.com> wrote:
> Good question. Only a couple of weeks ago I fixed a big object file bloat by moving stuff like this:
>
> static assert(e1);
> static assert(e2);
> static assert(e3);
>
> inside a unittest:
>
> unittest
> {
> ? ?static assert(e1);
> ? ?static assert(e2);
> ? ?static assert(e3);
> }
>
> I recall that the size of hello.o decreased from 30KB to 1.9KB.

It's quite bad that this is happening. We'll need to look into this eventually.