Jump to page: 1 25  
Page
Thread overview
static if enhancement
Jun 24, 2016
Mathias Lang
Jun 24, 2016
jmh530
Jun 29, 2016
Wyatt
Jun 30, 2016
Wyatt
Jun 27, 2016
Jonathan M Davis
Jun 27, 2016
QAston
Jun 24, 2016
JohnnyC
Jun 24, 2016
Stefan Koch
Jun 24, 2016
Stefan Koch
Jun 24, 2016
deadalnix
Jun 24, 2016
deadalnix
Jun 24, 2016
ketmar
Jun 25, 2016
Uranuz
Jun 25, 2016
Claude
Jun 25, 2016
cym13
Jun 25, 2016
ketmar
Jun 27, 2016
Claude
Jun 27, 2016
cym13
Jun 27, 2016
Timon Gehr
Jun 27, 2016
deadalnix
Jun 27, 2016
cym13
Jun 27, 2016
Jonathan M Davis
Jun 27, 2016
Stefan Koch
Jun 28, 2016
QAston
Jun 28, 2016
deadalnix
Jun 28, 2016
QAston
Jun 28, 2016
deadalnix
Jun 28, 2016
Jonathan M Davis
Jun 27, 2016
Claude
Jun 27, 2016
ketmar
Jun 25, 2016
Uranuz
Jun 26, 2016
QAston
Jun 26, 2016
QAston
June 24, 2016
Does anyone else find this annoying? https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
June 24, 2016
On 6/24/16 11:24 AM, Andrei Alexandrescu wrote:
> Does anyone else find this annoying?
> https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei

Maybe. That bug report does not identify any problems. What happens that's currently bad?

-Steve
June 24, 2016
On Friday, 24 June 2016 at 15:24:48 UTC, Andrei Alexandrescu wrote:
> Does anyone else find this annoying? https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei

This would mean treating static if's differently if they alter control flow in a scope larger then themselves.

Special casing a static if that returns would not be as bad.
But with the current state of the compiler I would hold of on such complications.
June 24, 2016
On Friday, 24 June 2016 at 15:34:42 UTC, Stefan Koch wrote:
> On Friday, 24 June 2016 at 15:24:48 UTC, Andrei Alexandrescu wrote:
>> Does anyone else find this annoying? https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
>
> This would mean treating static if's differently if they alter control flow in a scope larger then themselves.
>
> Special casing a static if that returns would not be as bad.
> But with the current state of the compiler I would hold of on such complications.

To elaborate:
 This requires control-flow analysis over all static if branches,
 to find and very one special case which we treat specially.

 It would only be beneficial If we hit this case predominantly.

 However, I am not sure how much langauge complexity this adds.
June 24, 2016
On Friday, 24 June 2016 at 15:29:18 UTC, Steven Schveighoffer wrote:
> On 6/24/16 11:24 AM, Andrei Alexandrescu wrote:
>> Does anyone else find this annoying?
>> https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
>
> Maybe. That bug report does not identify any problems. What happens that's currently bad?
>
> -Steve

Same question: What is the actual problem ?
One issue that can arise is https://issues.dlang.org/show_bug.cgi?id=14835 . Is there any other ?
June 24, 2016
On 06/24/2016 11:47 AM, Mathias Lang wrote:
> On Friday, 24 June 2016 at 15:29:18 UTC, Steven Schveighoffer wrote:
>> On 6/24/16 11:24 AM, Andrei Alexandrescu wrote:
>>> Does anyone else find this annoying?
>>> https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
>>
>> Maybe. That bug report does not identify any problems. What happens
>> that's currently bad?
>>
>> -Steve
>
> Same question: What is the actual problem ?
> One issue that can arise is
> https://issues.dlang.org/show_bug.cgi?id=14835 . Is there any other ?

The problem is excessive indentation. -- Andrei
June 24, 2016
On Friday, 24 June 2016 at 15:29:18 UTC, Steven Schveighoffer wrote:
> On 6/24/16 11:24 AM, Andrei Alexandrescu wrote:
>> Does anyone else find this annoying?
>> https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
>
> Maybe. That bug report does not identify any problems. What happens that's currently bad?
>
> -Steve

Second that, can't see anything bad there!
June 24, 2016
On Friday, 24 June 2016 at 17:03:55 UTC, JohnnyC wrote:
> On Friday, 24 June 2016 at 15:29:18 UTC, Steven Schveighoffer wrote:
>> On 6/24/16 11:24 AM, Andrei Alexandrescu wrote:
>>> Does anyone else find this annoying?
>>> https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
>>
>> Maybe. That bug report does not identify any problems. What happens that's currently bad?
>>
>> -Steve
>
> Second that, can't see anything bad there!

The problem (that I see) is, that if you don't create the "else" path but the "static if" condition is true, you generate dead code behind the return statement (if the compiler doesn't optimize that away).
In our company that would be a no-go. So you always have to explicitly write (and indent) the else path.
June 24, 2016
On 6/24/16 12:19 PM, Andrei Alexandrescu wrote:
> On 06/24/2016 11:47 AM, Mathias Lang wrote:
>> On Friday, 24 June 2016 at 15:29:18 UTC, Steven Schveighoffer wrote:
>>> On 6/24/16 11:24 AM, Andrei Alexandrescu wrote:
>>>> Does anyone else find this annoying?
>>>> https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
>>>
>>> Maybe. That bug report does not identify any problems. What happens
>>> that's currently bad?
>>>
>>
>> Same question: What is the actual problem ?
>> One issue that can arise is
>> https://issues.dlang.org/show_bug.cgi?id=14835 . Is there any other ?
>
> The problem is excessive indentation. -- Andrei

The problem that hasn't been made clear is, why can't you just write:

static if(condition)
{
    ... // some code
    return;
}

// some more code

And the answer is, I'm guessing, bug 14835 -- misguided "unreachable statement" warnings.

Should we mark your bug as a duplicate?

-Steve
June 24, 2016
On 6/24/16 1:15 PM, Steven Schveighoffer wrote:
> The problem that hasn't been made clear is, why can't you just write:
>
> static if(condition)
> {
>     ... // some code
>     return;
> }
>
> // some more code
>
> And the answer is, I'm guessing, bug 14835 -- misguided "unreachable
> statement" warnings.
>
> Should we mark your bug as a duplicate?

Sorry, the problem is that the code doesn't compile at all if the static if is false. So I need to insert the "else".

The compiler should not attempt at all to compile the code after the static if.


Andrei

« First   ‹ Prev
1 2 3 4 5