January 14, 2005
In article <cs99e3$25j$1@digitaldaemon.com>, Lionello Lunesu says...
>
>While dumping some thoughts in code on the state of variables I found myself typing 'loose' boolean expression:
>
>   mindh[y][x][0] == -maxdh[y][x-1][1];
>
>Now, wouldn't that be a cool syntax for assertions? No function call. It totally fits into D's Design By Contract and it's very readable (I often find myself wondering what value it was assert(x) aborts on).
>
>Lionello.
>
>

IMO, there's one problem with this.  The 'assert()' statement clearly defines a hook for an assertion, and is easy to spot in the code.  It also triggers conditional compilation as the *first* token of an expression (actually wraps the expression, but it still comes ahead of the rest).

Since expressions are perfectly valid without an assignment to an lvalue (think function returning 'int' with no assignment), how would the compiler 'see' that this is an assert.

Judging by how the frontend for DMC is designed, it would be extremely hard to hack that sort of thing in without the kind of linguistic hook that 'assert' provides.  This is due in part to the fact that boolean expressions resolve to integer expressions: there's no difference, so how would the compiler know when an expression falls into this special case?

Also, it's compact but not as readable as 'assert()'.  That is, it doesn't stand out as anything other than normal code, so I wouldn't expect it to dissapear once I go to release build.

Pragma - ericanderton at yahoo
January 14, 2005
John Reimer wrote:
> Yes, it seems to!  It includes the adapter for normal VGA (according to
> the specs).
> 
> 
> On Thu, 13 Jan 2005 11:50:20 -0600, Charles wrote:
> 
> 
>>It does look cool , always wanted  one too.  Does it work with any monitor
>>or do you need a MAC monitor ?
>>
>>Charlie
>>
>>"John Reimer" <brk_6502@yahoo.com> wrote in message
>>news:pan.2005.01.12.08.01.23.417711@yahoo.com...
>>
>>>The announcement of the new mac is all over the place now.  Judging from
>>>the response, it looks like it's quite popular.  I sure like the looks of
>>>it!  I might be bated into testing it out some day. :-)
>>>
>>>
> 
> 

The only problem I'd have with that (aside from not having enough money to upgrade my current computer, let alone buy a new one), is that I'd be isolating myself even farther from the gaming world than I am by running Linux...though I could totally see using one of those as a development computer.

-PIB
January 16, 2005
I have an idea for assertion syntax:

// My assertion has side-effects on debug.
// On release, always returns 1.
int monkey_assert(exp);

//e.g.
if(monkey_assert(check_something()))
{ ... }
else{ ... }


January 17, 2005
Mr. Monkey wrote:

> I have an idea for assertion syntax:
> 
> // My assertion has side-effects on debug.
> // On release, always returns 1.
> int monkey_assert(exp);
> 
> //e.g.
> if(monkey_assert(check_something()))
> { ... }
> else{ ... }

I don't understand: What would it mean?
1 2
Next ›   Last »