Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
briandowns opened this issue Oct 1, 2023 · 4 comments
Open
1 task done

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

briandowns opened this issue Oct 1, 2023 · 4 comments
Labels
feature request Discussion about a new feature

Comments

@briandowns
Copy link
Contributor

Is there an existing issue for this?

  • 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 briandowns added the feature request Discussion about a new feature label Oct 1, 2023
@Jason2605
Copy link
Member

Jason2605 commented Oct 6, 2023

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"], [...]])

@briandowns
Copy link
Contributor Author

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. 😂

@Jason2605
Copy link
Member

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

@briandowns
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Discussion about a new feature
Projects
None yet
Development

No branches or pull requests

2 participants