Type tuple pointers
    Meta via Digitalmars-d 
    digitalmars-d at puremagic.com
       
    Thu May 21 12:36:06 PDT 2015
    
    
  
On Thursday, 21 May 2015 at 16:11:30 UTC, Timon Gehr wrote:
> On 05/21/2015 05:37 PM, Dicebot wrote:
>> On Thursday, 21 May 2015 at 15:30:59 UTC, Alex Parrill wrote:
>>> They aren't types themselves, so `TypeTuple!(int, char) var` 
>>> doesn't
>>> make sense.
>>
>> Sadly, you are wrong on this one - this is actually a valid 
>> variable
>> declaration which will create two distinct local variables and 
>> uses
>> their aliases in resulting symbol list named 'var'.
>
> A wacky property of such variable declarations is this one:
>
> import std.stdio;
> alias Seq(T...)=T;
>
> void main(){
>     char y='a';
>     Seq!(char,char) x=y++;
>     writeln(x);
> }
import std.stdio;
alias Seq(T...)=T;
void main(){
     char y='a';
     Seq!(char,char) a=y++;             //ab
     Seq!(char,char) b=cast(char)(y+1); //bb
     Seq!(char,char) b=++y;             //bc
}
Certainly weird and unexpected behaviour.
    
    
More information about the Digitalmars-d
mailing list