Associative arrays
    Steven Schveighoffer 
    schveiguy at gmail.com
       
    Tue May 18 14:36:43 UTC 2021
    
    
  
On 5/18/21 9:04 AM, Adam D. Ruppe wrote:
> On Tuesday, 18 May 2021 at 12:57:01 UTC, Steven Schveighoffer
>> Let's make that 2 arrays (static or stack-allocated dynamic) to avoid 
>> the vararg template cost.
> 
> That's good for current AAs, but it can't do the heterogeneous types.
> 
> Of course that's illegal in D right now anyway I'm just holding out hope 
> for an expansion for json literals w/o explicit constructors on each 
> element too. :)
> 
> but yeah that'd work just fine too.
Hm... that does kind of make sense. I was thinking maybe you could 
specify the type of key to be something that accepts multiple 
constructor values (like translate to Json(val)) but then the expression 
isn't self-contained, it has to look at what it's being assigned to 
(which also is a possibility, after all, AA literal assignment can get 
type hints from the thing it's being assigned to).
I hope there's some way to avoid paying the variadic template penalty 
tax, which would be pretty heavy if you had a large literal (not uncommon).
-Steve
    
    
More information about the Digitalmars-d
mailing list