Arrays, garbage collection

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 29 21:02:10 PST 2015


On Friday, 30 January 2015 at 02:08:23 UTC, Andrei Alexandrescu 
wrote:
> On 1/29/15 5:08 PM, bearophile wrote:
>> What's missing is a handy and compiler-efficient syntax to 
>> create value
>> array literals. Some persons have proposed the "[]s" syntax:
>
> No, we need to define a function for that - please file an 
> enhancement request, thanks. -- Andrei

I don't think it is wize to add a new array literal syntax before 
:
  - added optimization to promote them on heap. Thing like int[2] 
= [1, 2] can trivially avoid GC allocation.
  - added some support for ownership/lifetime. This will allow the 
compiler to promote even more on heap.

If don't expect the new syntax to be that useful if these point 
are addressed. If I'm turn out to be wrong, we can reconsider at 
that point.


More information about the Digitalmars-d mailing list