Max Samukha wrote: > ... > > In D, [ has at least four meanings: > > auto a = [1, 2, 3]; - array initializer > a[1] - indexing operator > a[c..d] - slicing operator > int[10] - static array declarator > > C++ has [] for lambdas (no! C++ should be banned by the international > law, if there is any)
Actually, it's more like two. a[1] int[] int[10] a[c..d] These are all subscript notation. [1, 2, 3] [a:b, c:d] These are array literal notation. >From a strict, semantics nazi point of view, that's really six meanings. But that's like arguing there's a meaningful difference between a.b and A.b where a is a value and A is a type. It's worth noting that I still sometimes forget that [...] is for array literals, but I never ever forget its use for subscripting. -- Daniel