January 10, 2013
On 2013-01-10, 19:03, monarch_dodra wrote:

> On Thursday, 10 January 2013 at 17:46:54 UTC, Dmitry Olshansky wrote:
>> 10-Jan-2013 20:11, monarch_dodra пишет:
>>> On Thursday, 10 January 2013 at 15:54:21 UTC, Andrei Alexandrescu wrote:
>>>> On 1/10/13 6:23 AM, monarch_dodra wrote:
>>>>> So question: Why don't we have, just like for enforce, the possibility
>>>>> of simply writing:
>>>>> //----
>>>>> assert(i <= j, new RangeError());
>>>>> //----
>>>>
>>>> Define another function...?
>>>>
>>>> Andrei
>>>
>>> Well, I would. I'd write an overload, but I can't, because assert is
>>> built-in.
>>>
>>> I'd have to provide a new name (such as assertError). This would not be
>>> as convenient as having an overload. That, and a library function can't
>>> match assert's built-in functionality. For example:
>>>
>>> //----
>>> struct S()
>>> {
>>>   version(assert)
>>>     bool isValid = false; //debug only variable
>>>
>>>   void foo()
>>>   {
>>>     assertError(isValid, new RangeError()); //HERE
>>>   }
>>> }
>>> //----
>>>
>>> The problem is that at best, assertError can be a noop-implementation in
>>> release, but the call is still there. The first argument will still get
>>> evaluated. Further more, it may not even compile...
>>
>> lazy keyword to the rescue.
>
> Still doesn't compile though...


So you're saying this does compile for you, with -release?

struct S( ) {
    version(assert)
        bool isValid = false;

    void foo() {
        assert(isValid);
    }
}

It certainly does not for me.

-- 
Simen
January 10, 2013
On Thursday, 10 January 2013 at 19:31:18 UTC, Simen Kjaeraas wrote:
>
>
> So you're saying this does compile for you, with -release?
>
> struct S( ) {
>     version(assert)
>         bool isValid = false;
>
>     void foo() {
>         assert(isValid);
>     }
> }
>
> It certainly does not for me.

As a matter of fact, yes. Yes I am. Are you using 2.061 ?
January 10, 2013
On Thursday, 10 January 2013 at 19:47:46 UTC, monarch_dodra wrote:
> On Thursday, 10 January 2013 at 19:31:18 UTC, Simen Kjaeraas wrote:
>>
>>
>> So you're saying this does compile for you, with -release?
>>
>> struct S( ) {
>>    version(assert)
>>        bool isValid = false;
>>
>>    void foo() {
>>        assert(isValid);
>>    }
>> }
>>
>> It certainly does not for me.
>
> As a matter of fact, yes. Yes I am. Are you using 2.061 ?

Scratch that. Template was throwing me off.
January 10, 2013
On Thursday, 10 January 2013 at 18:31:17 UTC, Andrei Alexandrescu wrote:
>> And using "assertError" also still isn't as convenient as "assert"
>
> Please. You have the entire vocabulary minus assert.
>
>
> Andrei

Fine. I know how to take a hint.
January 10, 2013
On 1/10/13 11:56 AM, monarch_dodra wrote:
> On Thursday, 10 January 2013 at 18:31:17 UTC, Andrei Alexandrescu wrote:
>>> And using "assertError" also still isn't as convenient as "assert"
>>
>> Please. You have the entire vocabulary minus assert.
>>
>>
>> Andrei
>
> Fine. I know how to take a hint.

OK OK now you're making me feel bad for being abrupt :o). There is a back story to this. Generally we're trying to stem a tide of big trenches built around small points in this forum (things like the "one-click" issue in the changelog, hiding member variable names, etc). In such discussions we sometimes latch on one simple thing and set great store to it, to the point of losing a sense of proportion to its actual importance.

There must be a way to say: "OK, the point has been understood and well taken, but it has not been convincing enough" without getting anyone angry and without engendering a rehash of the argument.


Andrei
1 2
Next ›   Last »