On 06/23/2013 12:55 AM, H. S. Teoh wrote:
On Sat, Jun 22, 2013 at 10:57:53PM +0200, Jacob Carlborg wrote:
On 2013-06-22 18:40, H. S. Teoh wrote:

Yeah that one made my eyes glaze over. I still have trouble wrapping my
brain around the strange syntax of is(), and why its diverse uses have
been shoehorned into deceptively similar syntax.

Isn't quite a lot of the is-expression features undocumented?
[...]

Really? Well, even if so, the cases that *are* currently documented
share a lot of syntax, but aren't necessarily related in a way that the
syntax might imply. This is very confusing. One example that comes to
mind is using is(T _ == U) instead of is(T == U). I'm guessing most
people don't even know what the difference is, or why a dummy identifier
_ has to be added.


T


It's not a dummy identifier. It introduces _ as an alias to T if used inside a static if condition. Otherwise there is no difference.


void main(){
    static if(is(int _ == int)){
        _ x;
    }
    static assert(is(typeof(x)==int));
}

I don't know what the point of this feature is.

There used to be the issue that some forms of is were only available when the alias identifier was used. This has been fixed.

Reply via email to