Basic Syntax Question

Tobias Pankrath tobias at pankrath.net
Tue Apr 2 09:51:44 PDT 2013


On Tuesday, 2 April 2013 at 16:24:46 UTC, WhatMeWorry wrote:
>
> I don't suppose there is a digital.D.beginner forum?
>

There is D.learn. Scroll down in the webinterface :-)

> I've been staring at this definition for about an hour and I 
> still can't decode it.
>
> int[string][double[int[]]] a;  //
Read it left to right :-)

Let's rewrite the type with placeholders U,V.
int[string][double[int[]]] --> int[U][V]

int[U][V] is an AA mapping keys of type V to values int[U], which 
is itself an AA that maps U's to int's.

Now, what is U and V? U is string that was easy. V is 
double[int[]]. That again is an AA, mapping from int[] to double.


> int[string} a  // would be an Associate Array of integers with 
> a string key?

Nope, thats in syntax error.

> int[]  // would be a dynamic array of integers,i believe?
>
Correct.


More information about the Digitalmars-d-learn mailing list