chapel icon indicating copy to clipboard operation
chapel copied to clipboard

[Feature Request]: Support default initialization for heaps

Open lydia-duncan opened this issue 9 months ago • 0 comments

Summary of Feature

Description: I think you have to create a heap using new or the createHeap functions today. It would be nice to support something like var h: heap(eltType); (which doesn't work because the comparator field is generic) or var h: heap(eltType, parSafe, comparatorType); if you're trying to be very explicit.

Note that trying to write the former causes an error message that references the _lock field, which is not documented and so would probably be the first time a user is hearing about it (and not something we want to encourage users to rely on, since we'll want to support private fields at some point).

Is this a blocking issue with no known work-arounds? I don't think so, but I didn't encounter this while trying to write real code.

Code Sample

use Heap;

var h: heap(eltType);
var h2: heap(eltType, parSafe, comparatorType);

lydia-duncan avatar May 01 '24 18:05 lydia-duncan