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

[stdlib] Rename List.size to List._len and refactor usage of the field to use the public API #3814

Closed
wants to merge 34 commits into from

Conversation

martinvuyk
Copy link
Contributor

@martinvuyk martinvuyk commented Nov 27, 2024

Rename List.size to List._len and refactor usage of the field to use the public API.

Details:

@martinvuyk martinvuyk requested a review from a team as a code owner November 27, 2024 00:39
@martinvuyk
Copy link
Contributor Author

I'll leave this as draft until a decision is made of whether to deprecate accessing the fields directly. Since this implementation will have issues when trying to access the field with an immediate operation e.g. some_list.length += 1, which was solved only for some_list.size += 1 by making size the default getattr field name

@martinvuyk martinvuyk marked this pull request as draft December 2, 2024 17:48
@JoeLoser
Copy link
Collaborator

JoeLoser commented Dec 4, 2024

Personal opinion: I'd like it if we could just deprecate letting people modify the length variable directly (removing setters and getters), and make them use the public API.

Let's do that and remove the setters/getters.

Can you please also add a changelog entry so people understand their compiler errors as a result of this change if they are accessing the length field directly of List?

@JoeLoser JoeLoser added the waiting for response Needs action/response from contributor before a PR can proceed label Dec 4, 2024
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk martinvuyk force-pushed the make-list-size-private branch from 6e070d8 to 2c7857d Compare December 4, 2024 13:52
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk martinvuyk changed the title [stdlib] Rename List.size to List._len adding getattr and setattr for size [stdlib] Rename List.size to List._len and refactor usage of the field to use the public API Dec 4, 2024
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk martinvuyk marked this pull request as ready for review December 4, 2024 14:53
@martinvuyk martinvuyk requested a review from JoeLoser December 4, 2024 14:58
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk martinvuyk marked this pull request as draft December 10, 2024 22:44
modularbot added a commit that referenced this pull request Dec 21, 2024
…pan[Scalar[D]]` (#52584)

[External] [stdlib] Add `List[Scalar[D]].extend()` from `SIMD` and
`Span[Scalar[D]]`

Add `List[Scalar[D]].extend()` from `SIMD` and `Span[Scalar[D]]`

Split off from #3814. This is needed to enable efficient
appending of scalar value sequences to a `List` without having to resort
to `UnsafePointer` manually.

ORIGINAL_AUTHOR=martinvuyk
<110240700+martinvuyk@users.noreply.github.com>
PUBLIC_PR_LINK=#3854

Co-authored-by: martinvuyk <110240700+martinvuyk@users.noreply.github.com>
Co-authored-by: Connor Gray <code@connorgray.com>
Closes #3854
MODULAR_ORIG_COMMIT_REV_ID: 7d0c724497ba0671ae660f4de5758d6c4baad7bc
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk
Copy link
Contributor Author

Hi @arthurevans thanks for the input, you're totally right that this needed some examples :)

Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
modularbot added a commit that referenced this pull request Feb 13, 2025
…pan[Scalar[D]]` (#52584)

[External] [stdlib] Add `List[Scalar[D]].extend()` from `SIMD` and
`Span[Scalar[D]]`

Add `List[Scalar[D]].extend()` from `SIMD` and `Span[Scalar[D]]`

Split off from #3814. This is needed to enable efficient
appending of scalar value sequences to a `List` without having to resort
to `UnsafePointer` manually.

ORIGINAL_AUTHOR=martinvuyk
<110240700+martinvuyk@users.noreply.github.com>
PUBLIC_PR_LINK=#3854

Co-authored-by: martinvuyk <110240700+martinvuyk@users.noreply.github.com>
Co-authored-by: Connor Gray <code@connorgray.com>
Closes #3854
MODULAR_ORIG_COMMIT_REV_ID: 7d0c724497ba0671ae660f4de5758d6c4baad7bc
@ConnorGray
Copy link
Collaborator

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label Feb 25, 2025
@martinvuyk martinvuyk requested a review from a team as a code owner February 26, 2025 13:32
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk
Copy link
Contributor Author

I didn't request a review :o . Just edited something that was a silly mistake

@JoeLoser
Copy link
Collaborator

!sync

@JoeLoser
Copy link
Collaborator

Quick update here: I've fixed (almost) all of our internal use so this should land soon internally. I'm OOO tomorrow, so if it doesn't land tonight/soon, it will land Friday. Thanks, Martin!

@JoeLoser JoeLoser removed the waiting for response Needs action/response from contributor before a PR can proceed label Feb 27, 2025
@modularbot
Copy link
Collaborator

✅🟣 This contribution has been merged 🟣✅

Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the main branch during the next Mojo nightly release, typically within the next 24-48 hours.

We use Copybara to merge external contributions, click here to learn more.

@modularbot modularbot added merged-internally Indicates that this pull request has been merged internally merged-externally Merged externally in public mojo repo labels Feb 27, 2025
@modularbot
Copy link
Collaborator

Landed in 5f2570f! Thank you for your contribution 🎉

@martinvuyk martinvuyk deleted the make-list-size-private branch February 27, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported-internally Signals that a given pull request has been imported internally. merged-externally Merged externally in public mojo repo merged-internally Indicates that this pull request has been merged internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants