Jump to page: 1 26  
Page
Thread overview
assert(condition[, message]) patch
Feb 02, 2006
braddr
Feb 02, 2006
Hasan Aljudy
Feb 02, 2006
braddr
Feb 02, 2006
braddr
Feb 02, 2006
Yves Jacoby
Feb 02, 2006
Psi Oddech
May 30, 2006
braddr
May 30, 2006
akcom
May 31, 2006
BCS
May 31, 2006
Daniel Keep
May 31, 2006
Bruno Medeiros
May 31, 2006
Daniel Keep
Jun 02, 2006
Bruno Medeiros
May 31, 2006
Sean Kelly
May 31, 2006
Walter Bright
May 31, 2006
BCS
May 31, 2006
Brad Roberts
Jun 01, 2006
Brad Roberts
May 31, 2006
Chris Miller
May 31, 2006
Walter Bright
May 31, 2006
Chris Miller
May 31, 2006
Lars Ivar Igesund
May 31, 2006
Tom S
Jul 31, 2006
Joseph Lisee
Jul 31, 2006
Brad Roberts
Jul 31, 2006
Sean Kelly
Aug 01, 2006
Joseph Lisee
Aug 01, 2006
Kirk McDonald
Aug 01, 2006
Joseph Lisee
Aug 01, 2006
Kirk McDonald
Aug 02, 2006
Joseph Lisee
Re: [Off topic] assert(condition[, message]) patch
May 31, 2006
Sean Kelly
May 31, 2006
Derek Parnell
May 31, 2006
BCS
May 31, 2006
Sean Kelly
Jun 01, 2006
kris
Jun 01, 2006
Derek Parnell
Jun 01, 2006
Derek Parnell
Jun 01, 2006
kris
Jun 01, 2006
Derek Parnell
Jun 01, 2006
kris
Jun 01, 2006
Daniel Keep
Jun 01, 2006
pragma
Jun 01, 2006
Oskar Linde
stack tracing {was assert(condition[, message]) patch}
Jun 01, 2006
kris
Jun 02, 2006
James Dunne
Jun 02, 2006
Brad Roberts
Jun 02, 2006
kris
Jun 02, 2006
Don Clugston
Jun 02, 2006
BCS
Jun 01, 2006
Sean Kelly
Jun 02, 2006
Don Clugston
Jun 01, 2006
Thomas Kuehne
February 02, 2006
I have been toying with D to bring myself up to speed and I found myself writing a lot of unit tests, always a good thing.  In those unit tests I found myself writing a lot of blocks like:

if (cond)
{
writefln("some debugging output to make my life easier");
assert(false);
}

I know many don't like unit tests to have output, but I do.  To simplify this, I've created a patch for gdc/dmd to allow this syntax instead:

assert(cond, "some optional debugging output to make my life easier");

http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff http://www.puremagic.com/~braddr/d/assert-test.d

I've run this through dstress with no regressions.

Anyone wanna give it a whirl?

Later,
Brad


February 02, 2006
braddr@puremagic.com wrote:
> I have been toying with D to bring myself up to speed and I found myself writing
> a lot of unit tests, always a good thing.  In those unit tests I found myself
> writing a lot of blocks like:
> 
> if (cond)
> {
> writefln("some debugging output to make my life easier");
> assert(false);
> }
> 
> I know many don't like unit tests to have output, but I do.  To simplify this,
> I've created a patch for gdc/dmd to allow this syntax instead:
> 
> assert(cond, "some optional debugging output to make my life easier");
> 
> http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff
> http://www.puremagic.com/~braddr/d/assert-test.d
> 
> I've run this through dstress with no regressions.
> 
> Anyone wanna give it a whirl?
> 
> Later,
> Brad
> 
> 

How can we install/apply the patch?
February 02, 2006
Does this effect static asserts?  Currently, you can do this with them:

static assert ("Some message.", 0);

This is because it is passed an expression, and so "", 0 just evaluates to 0.  But it does display the whole thing.

-[Unknown]


> I have been toying with D to bring myself up to speed and I found myself writing
> a lot of unit tests, always a good thing.  In those unit tests I found myself
> writing a lot of blocks like:
> 
> if (cond)
> {
> writefln("some debugging output to make my life easier");
> assert(false);
> }
> 
> I know many don't like unit tests to have output, but I do.  To simplify this,
> I've created a patch for gdc/dmd to allow this syntax instead:
> 
> assert(cond, "some optional debugging output to make my life easier");
> 
> http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff
> http://www.puremagic.com/~braddr/d/assert-test.d
> 
> I've run this through dstress with no regressions.
> 
> Anyone wanna give it a whirl?
> 
> Later,
> Brad
> 
> 
February 02, 2006
In article <drs52m$mu$1@digitaldaemon.com>, Unknown W. Brackets says...

>> I have been toying with D to bring myself up to speed and I found myself writing a lot of unit tests, always a good thing.  In those unit tests I found myself writing a lot of blocks like:
>> 
>> if (cond)
>> {
>> writefln("some debugging output to make my life easier");
>> assert(false);
>> }
>> 
>> I know many don't like unit tests to have output, but I do.  To simplify this, I've created a patch for gdc/dmd to allow this syntax instead:
>> 
>> assert(cond, "some optional debugging output to make my life easier");
>> 
>> http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff http://www.puremagic.com/~braddr/d/assert-test.d
>> 
>> I've run this through dstress with no regressions.
>> 
>> Anyone wanna give it a whirl?
>> 
>> Later,
>> Brad
>
>Does this effect static asserts?  Currently, you can do this with them:
>
>static assert ("Some message.", 0);
>
>This is because it is passed an expression, and so "", 0 just evaluates to 0.  But it does display the whole thing.
>
>-[Unknown]

<peeking at the code...>

Looks like assert and static assert are handled by completely different blocks of code, completely.  so, static assert(...) is unchanged.

Later,
Brad


February 02, 2006
In article <drs0sb$2vhj$1@digitaldaemon.com>, Hasan Aljudy says...
>
>braddr@puremagic.com wrote:
>> I have been toying with D to bring myself up to speed and I found myself writing a lot of unit tests, always a good thing.  In those unit tests I found myself writing a lot of blocks like:
>> 
>> if (cond)
>> {
>> writefln("some debugging output to make my life easier");
>> assert(false);
>> }
>> 
>> I know many don't like unit tests to have output, but I do.  To simplify this, I've created a patch for gdc/dmd to allow this syntax instead:
>> 
>> assert(cond, "some optional debugging output to make my life easier");
>> 
>> http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff http://www.puremagic.com/~braddr/d/assert-test.d
>> 
>> I've run this through dstress with no regressions.
>> 
>> Anyone wanna give it a whirl?
>> 
>> Later,
>> Brad
>> 
>> 
>
>How can we install/apply the patch?

Save the .diff to a file, use the standard unix tool 'patch' to apply it to a gcc+gdc source tree from the gcc directory, and rebuild gdc.

Later,
Brad


February 02, 2006
On Thu, 02 Feb 2006 01:35:20 +0000, braddr wrote:

> I have been toying with D to bring myself up to speed and I found myself writing a lot of unit tests, always a good thing.  In those unit tests I found myself writing a lot of blocks like:
> 
> if (cond)
> {
> writefln("some debugging output to make my life easier");
> assert(false);
> }
> 
> I know many don't like unit tests to have output, but I do.  To simplify this, I've created a patch for gdc/dmd to allow this syntax instead:
> 
> assert(cond, "some optional debugging output to make my life easier");
> 
> http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff http://www.puremagic.com/~braddr/d/assert-test.d
> 
> I've run this through dstress with no regressions.
> 
> Anyone wanna give it a whirl?
> 
> Later,
> Brad

Simply "Thank you". Great thing.

February 02, 2006
braddr wrote:

> I know many don't like unit tests to have output, but I do.  To simplify this,
> I've created a patch for gdc/dmd to allow this syntax instead:
> 
> assert(cond, "some optional debugging output to make my life easier");

Excellent, I would be happy to include this in "gdcmac" for instance.
(if there aren't any objections to including "non-offical" D patches
into the compiler, already have a few necessary-for-portability ones)

Too bad that it doesn't get past the:
assert(false, "Walter didn't like it");

--anders
February 02, 2006
It's been a while since I've programmed something but I used something along the
lines of assert(condition && "whatever") or assert(condition &&
printf("whatever")), whichever worked.

In article <drrnko$2onm$1@digitaldaemon.com>, braddr@puremagic.com says...
>
>I have been toying with D to bring myself up to speed and I found myself writing a lot of unit tests, always a good thing.  In those unit tests I found myself writing a lot of blocks like:
>
>if (cond)
>{
>writefln("some debugging output to make my life easier");
>assert(false);
>}
>
>I know many don't like unit tests to have output, but I do.  To simplify this, I've created a patch for gdc/dmd to allow this syntax instead:
>
>assert(cond, "some optional debugging output to make my life easier");
>
>http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff http://www.puremagic.com/~braddr/d/assert-test.d
>
>I've run this through dstress with no regressions.
>
>Anyone wanna give it a whirl?
>
>Later,
>Brad
>
>


May 30, 2006
In article <drrnko$2onm$1@digitaldaemon.com>, braddr@puremagic.com says...
>
>I have been toying with D to bring myself up to speed and I found myself writing a lot of unit tests, always a good thing.  In those unit tests I found myself writing a lot of blocks like:
>
>if (cond)
>{
>writefln("some debugging output to make my life easier");
>assert(false);
>}
>
>I know many don't like unit tests to have output, but I do.  To simplify this, I've created a patch for gdc/dmd to allow this syntax instead:
>
>assert(cond, "some optional debugging output to make my life easier");
>
>http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff http://www.puremagic.com/~braddr/d/assert-test.d
>
>I've run this through dstress with no regressions.
>
>Anyone wanna give it a whirl?
>
>Later,
>Brad

I was just about to start bringing this patch up to work with current dmd and gdc but decided I should ask first:

Is anyone using it with gdc 0.17?
Would anyone use it if I freshened it up?
Walter, would you be interested / willing to incorporate the parser part into
dmd and support the feature in dmd?

I've seen a couple alternatives suggested, but they've all been somewhat hacky, imho.

Later,
Brad


May 30, 2006
braddr@puremagic.com wrote:
> In article <drrnko$2onm$1@digitaldaemon.com>, braddr@puremagic.com says...
>> I have been toying with D to bring myself up to speed and I found myself writing
>> a lot of unit tests, always a good thing.  In those unit tests I found myself
>> writing a lot of blocks like:
>>
>> if (cond)
>> {
>> writefln("some debugging output to make my life easier");
>> assert(false);
>> }
>>
>> I know many don't like unit tests to have output, but I do.  To simplify this,
>> I've created a patch for gdc/dmd to allow this syntax instead:
>>
>> assert(cond, "some optional debugging output to make my life easier");
>>
>> http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff
>> http://www.puremagic.com/~braddr/d/assert-test.d
>>
>> I've run this through dstress with no regressions.
>>
>> Anyone wanna give it a whirl?
>>
>> Later,
>> Brad
> 
> I was just about to start bringing this patch up to work with current dmd and
> gdc but decided I should ask first:
> 
> Is anyone using it with gdc 0.17?
> Would anyone use it if I freshened it up?
> Walter, would you be interested / willing to incorporate the parser part into
> dmd and support the feature in dmd?
> 
> I've seen a couple alternatives suggested, but they've all been somewhat hacky,
> imho.
> 
> Later,
> Brad
> 
> 
Just my thoughts, I think it's definitely got some merits, although one must consider that the assert( statementToTest ) would give you the line that threw the assert, which makes a message a bit less important. Although, on the other hand, if someone (ie not someone who wrote the code) were to see the assert and check the given line, it probably wouldn't mean too much to them, whereas being able to see a message associated with it would be a bit more useful.  I'd definitely give the mod a whirl.
« First   ‹ Prev
1 2 3 4 5 6