--- Comment #13 from 2012-04-30 17:38:59 PDT ---
(In reply to comment #11 and comment #12)

I agree with the need for some syntactic sugar for static array literal, but is
there any scenario where the postfix literal "auto x=[1,2,3]S" (or [1,2,3]f if
you prefer) proposed in [Issue 8008] doesn't advantageously replace
int[$]x=[1,2,3]? (more generally to force type T in case of ambiguity we can
write [cast(T)1,2,3]S but usually not necessary with 1u,1f etc).

The advantage of [1,2,3]S over [$] or the current situation being that:

1) we can directly pass a static array to a function without requiring an
intermediate static array declaration (int[$]x=[1,2,3]; fun(x); becomes simply

2) from my understanding, there is still an intermediate heap allocation with
the current int[3]=[1,2,3]; please correct me if I'm wrong), which should be
easier to avoid with [1,2,3]S). 

(As an optional bonus, would it also be easy to implement implicit casts with
[...]S ? eg
   void fun(in double[3] x){...}
   fun([1,2,3]S); //should do implicit cast to double[3]; 
   //the implicit casts should follow the same rules as for numeric values. )

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to