September 15, 2014
On 09/15/2014 04:53 AM, Timon Gehr wrote:
> On 09/15/2014 12:38 AM, Walter Bright wrote:
>> On 9/14/2014 2:48 PM, deadalnix wrote:
>>> If that is really a concern, please consider commenting on
>>> http://wiki.dlang.org/DIP31
>>
>> I haven't thought it through, but the DIP looks like a good idea.
>>
>> It should add the test case in this thread,
>>
>>    static if(!is(typeof(x))) enum y=2;
>>    static if(!is(typeof(y))) enum x=1;
>>
>> as being something that is detected and rejected by the compiler.
>>
>> Essentially, anything that is order-of-evaluation dependent should be
>> detected and rejected.
>
> (It is furthermore also important that most programs that are not
> dependent on evaluation order are still accepted.)

To elaborate a little: The following simple test case cannot be accepted using a strategy that alternately analyses AST nodes and poisons symbols that do not occur in certain scopes:

enum x = "enum xx = q{int y = 0;};";

struct SS{
    mixin(xx);
    mixin(x);
}

However, it can be given a unique meaning.
September 15, 2014
Andrei Alexandrescu:

> C++ intelligentsia seems to have a superiority complex with regard to D, and that's entirely understandable.

D and C++ compete for a similar programming niche, but C++ is so much widespread compared to D, that it's like comparing a blue whale with an ant. In practice there is no real match and competition. D is not going to replace C++ in the next few years, and probably it will not eat a significant percentage of the C++ pie. So I think it's a good idea to have a little more collaboration between the two language communities. Such "superiority complex" is not going to help any one.

Bye,
bearophile
September 15, 2014
On 9/15/14, 11:17 AM, bearophile wrote:
> Andrei Alexandrescu:
>
>> C++ intelligentsia seems to have a superiority complex with regard to
>> D, and that's entirely understandable.
>
> D and C++ compete for a similar programming niche, but C++ is so much
> widespread compared to D, that it's like comparing a blue whale with an
> ant.

Just for fun...

Blue whale mass: 190,000 kg on average (Adult)
Typical red/black ant mass: 0.003 to 0.005 grams
Ratio: 38,000,000,000x

Rough estimates for the size of the D community (based on dmd downloads) would place it in the tens of thousands. C++ users would be over 1 million. So...

> In practice there is no real match and competition. D is not going
> to replace C++ in the next few years, and probably it will not eat a
> significant percentage of the C++ pie. So I think it's a good idea to
> have a little more collaboration between the two language communities.
> Such "superiority complex" is not going to help any one.

You may be misunderstanding something. You're telling this to the wrong people.


Andrei

September 17, 2014
On Sunday, 14 September 2014 at 22:58:44 UTC, David Nadlinger wrote:
> On Sunday, 14 September 2014 at 07:35:12 UTC, Daniel Murphy wrote:
>> I do acknowledge this is a problem, but I am yet to run into it in actual D code.  Most of my static ifs are either inside templates, inside functions, or are being used to bypass version's limitations.
>
> I tend to run into forward referencing issues all the time "declarative" metaprogramming, i.e. when generating some code based on existing symbols and their attributes (e.g. serialization, RPC, …). Manu IIRC also has some related war stories to tell.
>
> Granted, it's not the directly the same as two ifs next to each other conflicting (you mostly get dependencies via __traits(allMembers, …) and so on), but whatever forward reference resolution mechanism we choose must be able to handle both the same.
>
> David

Yes, this is not uncommon way to hit the wall. Separating reflection/generation "stages" into different modules and keeping an eye for cyclic imports seems like a best way to address it right now in my opinion.
September 17, 2014
On Monday, 15 September 2014 at 03:10:08 UTC, Timon Gehr wrote:
> On 09/15/2014 04:53 AM, Timon Gehr wrote:
>> On 09/15/2014 12:38 AM, Walter Bright wrote:
>>> On 9/14/2014 2:48 PM, deadalnix wrote:
>>>> If that is really a concern, please consider commenting on
>>>> http://wiki.dlang.org/DIP31
>>>
>>> I haven't thought it through, but the DIP looks like a good idea.
>>>
>>> It should add the test case in this thread,
>>>
>>>   static if(!is(typeof(x))) enum y=2;
>>>   static if(!is(typeof(y))) enum x=1;
>>>
>>> as being something that is detected and rejected by the compiler.
>>>
>>> Essentially, anything that is order-of-evaluation dependent should be
>>> detected and rejected.
>>
>> (It is furthermore also important that most programs that are not
>> dependent on evaluation order are still accepted.)
>
> To elaborate a little: The following simple test case cannot be accepted using a strategy that alternately analyses AST nodes and poisons symbols that do not occur in certain scopes:
>
> enum x = "enum xx = q{int y = 0;};";
>
> struct SS{
>     mixin(xx);
>     mixin(x);
> }
>
> However, it can be given a unique meaning.

I remember deadlnix telling quite a lot of nice stories about how this makes in sort of SDC parallelisation problematic :)
September 30, 2014
On Monday, 15 September 2014 at 18:17:37 UTC, bearophile wrote:
> Andrei Alexandrescu:
>
>> C++ intelligentsia seems to have a superiority complex with regard to D, and that's entirely understandable.
>
> D and C++ compete for a similar programming niche, but C++ is so much widespread compared to D, that it's like comparing a blue whale with an ant. In practice there is no real match and competition. D is not going to replace C++ in the next few years, and probably it will not eat a significant percentage of the C++ pie. So I think it's a good idea to have a little more collaboration between the two language communities. Such "superiority complex" is not going to help any one.
>
> Bye,
> bearophile

The problem is, the C++ community is unwilling to collaborate
with anyone else and this attitude is encouraged by Stroustrup.
September 30, 2014
On Tuesday, 30 September 2014 at 00:02:49 UTC, SomeDude wrote:
> The problem is, the C++ community is unwilling to collaborate
> with anyone else and this attitude is encouraged by Stroustrup.

What makes you think so ? I'm not telling you are wrong, simply
not that familiar with C++ inner circles.
September 30, 2014
SomeDude:

> The problem is, the C++ community is unwilling to collaborate
> with anyone else and this attitude is encouraged by Stroustrup.

The C++ language has plenty of warts and unnecessary complexities, but to me the C++ community seems normal, like other languages communities. Usually such communities don't collaborate a lot with other ones (I have seen the Python community collaborate a little with the Julia community, but such collaborations seem the exception).

Bye,
bearophile
September 30, 2014
Looks like this made it to reddit:

http://www.reddit.com/r/programming/comments/2hsxe2/alexandrescu_speaks_up_on_the_infamous_static_if/

September 30, 2014
On Tuesday, 30 September 2014 at 06:46:35 UTC, Walter Bright wrote:
> Looks like this made it to reddit:
>
> http://www.reddit.com/r/programming/comments/2hsxe2/alexandrescu_speaks_up_on_the_infamous_static_if/

I think the correct counter-attack is simply to write a note showing those cases that concepts lite do not solve, at least not as nicely as static if would have.

Eventually with D examples. It will bring audience.