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

use the construct operator to replace new_init() in the stdlib #1860

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Book-reader
Copy link
Contributor

currently just for the list as I don't have time today to do everything (hashmap, linkedlist, priorityqueue, dstring, etc)

please let me know if this is not wanted or if there are specific places where it is not wanted

@Book-reader Book-reader marked this pull request as draft January 17, 2025 11:02
@lerno
Copy link
Collaborator

lerno commented Jan 17, 2025

This is fine. Do you want to leave it a draft and add more to it?

@Book-reader
Copy link
Contributor Author

Yes, I will add more tomorrow and see what these failing tests are about

@Book-reader
Copy link
Contributor Author

Book-reader commented Jan 17, 2025

ah

+ fn List List.new(usz initial_capacity = 16, Allocator allocator = allocator::heap()) @operator(construct)

Unexpected error in vasplat_function_call.c3 line 4:"This method is already defined for 'List'."
image

that makes sense why it fails then

@lerno
Copy link
Collaborator

lerno commented Jan 20, 2025

I keep being on the fence about this. I don't know if operator(construct) is the right way to do this. I have a weird gut feeling that it's just complicating the language. It's like... static methods are not a thing EXCEPT for this weird special rule.

But then if that special rule is used all of the time, then doing it through "operator(construct)" is weird since it's used all of the time.

It's a whole lot cleaner than opening a new namespace but it's also a very odd corner in the language. I need to think about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants