On 4 February 2012 00:56, Steve Schveighoffer <[email protected]> wrote: > I'd much rather fix implicit storage of literals than incur both template > bloat and have to deal with type deduction. Besides the heap allocation > issue, the rewrite that Don put forth already uses the compiler to type > deduce the array types (and therefore the key and value types) without any > excessive template bloat. I'm assuming you meant something like: > > SomeRecursiveTemplateToDeduceKeyAndValue!(T) AALiteral(T...)(T vals) if > (vals.length % 2 == 0 && SomeRecursiveTemplateToEnsureKeyAndValueExist!(T)) > > What I was thinking is making something like: > > void foo(scope int[]) {} > not allocate the argument to foo on the heap if it's a literal. > > > -Steve
Note that there is no urgency on this. It's more important to get it right, and that includes avoiding unnecessary heap allocations. It should not be tied into the compiler, until it's behaving perfectly except for syntax sugar. _______________________________________________ dmd-internals mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-internals
