On Wednesday, 8 July 2015 at 08:24:00 UTC, Martin Nowak wrote:
On Wednesday, 8 July 2015 at 06:11:25 UTC, Uranuz wrote:
My idea is slihtly of topic.
I thiking about some API for array and associative array
literals.
There is already an API for array literals, typesafe variadic
arguments.
void foo(int[] literal...);
foo([0, 1, 2, 3]);
But what do you thing about just about idea?
We discussed this already.
https://issues.dlang.org/show_bug.cgi?id=11658
AA and array literals come with literals coercion rules,
heterogeneous literals would make the semantics of the literal
depend on the callsite.
We already have TypeTuple/Arguments for heterogeneous tuples.
As far as I understand from that discussion it this feature was
not accepted because of template bloat. Am I wrong? But it could
be very useful in situations. Another way is to create specific
parser that will parse some JSON-like DSL and genetate some code
after it that will create specific data structure. But I think it
not so nice an will lead to creation of different flavours and
parsers for such DSL's.