www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - is expression

reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
Hey,

in std.container, line 2623, I'm seeing

static if (is(_store.insertBack(value)))

The spec doesn't mention allowing expressions as far as I can remember, 
so what's the deal? Yes, the argument is ambiguous with type at parse 
time, but it has to get converted to an expression at some point. Is 
allowing expressions in is expression a definite keeper?
Jun 24 2010
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 06/24/2010 10:01 AM, Ellery Newcomer wrote:
 Hey,

 in std.container, line 2623, I'm seeing

 static if (is(_store.insertBack(value)))

 The spec doesn't mention allowing expressions as far as I can remember,
 so what's the deal? Yes, the argument is ambiguous with type at parse
 time, but it has to get converted to an expression at some point. Is
 allowing expressions in is expression a definite keeper?

My mistake, a typeof should wrap the expression. Andrei
Jun 24 2010
next sibling parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 06/24/2010 10:02 AM, Andrei Alexandrescu wrote:
 On 06/24/2010 10:01 AM, Ellery Newcomer wrote:
 Hey,

 in std.container, line 2623, I'm seeing

 static if (is(_store.insertBack(value)))

 The spec doesn't mention allowing expressions as far as I can remember,
 so what's the deal? Yes, the argument is ambiguous with type at parse
 time, but it has to get converted to an expression at some point. Is
 allowing expressions in is expression a definite keeper?

My mistake, a typeof should wrap the expression. Andrei

Ah, very good. Maybe the compiler should bug out on expressions?
Jun 24 2010
prev sibling parent reply Clemens <eriatarka84 gmail.com> writes:
Andrei Alexandrescu Wrote:

 On 06/24/2010 10:01 AM, Ellery Newcomer wrote:
 Hey,

 in std.container, line 2623, I'm seeing

 static if (is(_store.insertBack(value)))

 The spec doesn't mention allowing expressions as far as I can remember,
 so what's the deal? Yes, the argument is ambiguous with type at parse
 time, but it has to get converted to an expression at some point. Is
 allowing expressions in is expression a definite keeper?

My mistake, a typeof should wrap the expression.

...and this is exactly why we need meta.compiles(...) or something equivalent. That proposal had such an overwhelming backing by the community; what happened to it? There never was an official comment on it AFAIR. Such an addition should be fine even with TDPL out since it doesn't break anything, shouldn't it?
Jun 24 2010
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 06/24/2010 10:48 AM, Clemens wrote:
 Andrei Alexandrescu Wrote:

 On 06/24/2010 10:01 AM, Ellery Newcomer wrote:
 Hey,

 in std.container, line 2623, I'm seeing

 static if (is(_store.insertBack(value)))

 The spec doesn't mention allowing expressions as far as I can remember,
 so what's the deal? Yes, the argument is ambiguous with type at parse
 time, but it has to get converted to an expression at some point. Is
 allowing expressions in is expression a definite keeper?

My mistake, a typeof should wrap the expression.

...and this is exactly why we need meta.compiles(...) or something equivalent. That proposal had such an overwhelming backing by the community; what happened to it? There never was an official comment on it AFAIR. Such an addition should be fine even with TDPL out since it doesn't break anything, shouldn't it?

Yes, such an addition shouldn't interfere. Andrei
Jun 24 2010