Dictu icon indicating copy to clipboard operation
Dictu copied to clipboard

[FEATURE] Set (initial) size of list, set, dict

Open briandowns opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your feature request related to a problem?

It might be helpful to have the ability to specify the initial size of list, set, and dict. A user would set the initial size of the type but wouldn't prevent them from further extension.

Describe the solution you'd like

var dozen = newList(12);
var daysOfTheWeek = newDict(7);

Describe alternatives you've considered

No response

Additional context

No response

briandowns avatar Oct 01 '23 02:10 briandowns

Sounds good to me! I wonder if it's worth having a List / Dict namespace then later on we can add other methods that create these from method calls, i.e:

List.new(<number>);
Dict.new(<Number>);

List.fill(...)
Dict.from([["key", "value"], [...]])

Jason2605 avatar Oct 06 '23 16:10 Jason2605

I was thinking of doing that initially but decided to keep it simple at the outset. I'm happy to do whatever you think is best. I have a working implementation but need to find all the memory I'm leaking. 😂

briandowns avatar Oct 06 '23 16:10 briandowns

The joys of C right 😂 If it's not too much trouble I think the namespace would be the way to go as it saves us changing it later down the line

Jason2605 avatar Oct 06 '23 16:10 Jason2605

No trouble at all. I completely it'll be best.

briandowns avatar Oct 06 '23 16:10 briandowns