Skip to content

[stdlib] Deque - don't use non-self out args#3851

Closed
avitkauskas wants to merge 1 commit intomodular:nightlyfrom
avitkauskas:eliminate-out-args
Closed

[stdlib] Deque - don't use non-self out args#3851
avitkauskas wants to merge 1 commit intomodular:nightlyfrom
avitkauskas:eliminate-out-args

Conversation

@avitkauskas
Copy link
Copy Markdown
Contributor

As the original author of the Deque, I would like to propose to not use the out args instead of -> ElementType as element in pop() and popleft() methods.

The named return variable was just a simple convenience in these functions and not needed at all.

In general, having something in the args list of the function that you do not pass to the function at the call site looks weird (except for constructors). In my opinion, it makes the function signature just less clear to read and the return type of the function unnecessarily hidden inside the args list.

So, let's just use normal return statements here and have a clear function signatures.

Signed-off-by: Alvydas Vitkauskas <alvydas.vitkauskas@gmail.com>
@avitkauskas avitkauskas requested a review from a team December 9, 2024 21:47
@avitkauskas
Copy link
Copy Markdown
Contributor Author

Pre-commit fails because of reformating of stdlib/test/python/my_module.py file - nothing to do with this commit.
Should I reformat it and push again anyway?

@JoeLoser
Copy link
Copy Markdown
Member

Pre-commit fails because of reformating of stdlib/test/python/my_module.py file - nothing to do with this commit. Should I reformat it and push again anyway?

Don't worry about this right now. @keith and @walter-erquinigo are looking into it. See #3832.

@JoeLoser
Copy link
Copy Markdown
Member

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label Dec 10, 2024
@modularbot
Copy link
Copy Markdown
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 nightly 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 Dec 10, 2024
@modularbot
Copy link
Copy Markdown
Collaborator

Landed in 8123754! Thank you for your contribution 🎉

modularbot pushed a commit that referenced this pull request Dec 11, 2024
[External] [stdlib] Deque - don't use non-self out args

As the original author of the Deque, I would like to propose to not use
the `out` args instead of `-> ElementType as element` in `pop()` and
`popleft()` methods.

The named return variable was just a simple convenience in these
functions and not needed at all.

In general, having something in the args list of the function that you
do not pass to the function at the call site looks weird (except for
constructors). In my opinion, it makes the function signature just less
clear to read and the return type of the function unnecessarily hidden
inside the args list.

So, let's just use normal return statements here and have a clear
function signatures.

Co-authored-by: Alvydas Vitkauskas <alvydas.vitkauskas@gmail.com>
Closes #3851
MODULAR_ORIG_COMMIT_REV_ID: acae8a18cea7f91639d059e03dff88e3e3d1f5a5
@modularbot modularbot closed this Dec 11, 2024
@avitkauskas avitkauskas deleted the eliminate-out-args branch December 11, 2024 17:47
modularbot pushed a commit that referenced this pull request Feb 13, 2025
[External] [stdlib] Deque - don't use non-self out args

As the original author of the Deque, I would like to propose to not use
the `out` args instead of `-> ElementType as element` in `pop()` and
`popleft()` methods.

The named return variable was just a simple convenience in these
functions and not needed at all.

In general, having something in the args list of the function that you
do not pass to the function at the call site looks weird (except for
constructors). In my opinion, it makes the function signature just less
clear to read and the return type of the function unnecessarily hidden
inside the args list.

So, let's just use normal return statements here and have a clear
function signatures.

Co-authored-by: Alvydas Vitkauskas <alvydas.vitkauskas@gmail.com>
Closes #3851
MODULAR_ORIG_COMMIT_REV_ID: acae8a18cea7f91639d059e03dff88e3e3d1f5a5
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.

3 participants