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] Optional.value should return a Reference #2179

Closed
1 task done
lsh opened this issue Apr 4, 2024 · 5 comments
Closed
1 task done

[stdlib] Optional.value should return a Reference #2179

lsh opened this issue Apr 4, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-stdlib Tag for issues related to standard library

Comments

@lsh
Copy link
Contributor

lsh commented Apr 4, 2024

Review Mojo's priorities

What is your request?

The Optional docs for value() state that it should return a Reference when that is possible. Since the underlying Variant already returns a reference which is then dereferenced, this should be possible now.

What is your motivation for this change?

This is a planned feature per the comment on the method.

Any other details?

No response

@lsh lsh added enhancement New feature or request mojo Issues that are related to mojo labels Apr 4, 2024
@JoeLoser JoeLoser added the mojo-stdlib Tag for issues related to standard library label Apr 4, 2024
@StandinKP
Copy link

I will take this task up. Thanks

@StandinKP
Copy link

In this what should be passed into the lifetime component and the mutability component of the Reference?

@StandinKP
Copy link

@lsh I was working on this

@lsh
Copy link
Contributor Author

lsh commented Apr 7, 2024

@StandinKP didn't mean to step on any toes. This is a feature I wanted for a project, and I knew roughly how to wire up all the lifetimes and mutability in Reference, but am happy to close out in favor of whatever you have.

@StandinKP
Copy link

@StandinKP didn't mean to step on any toes. This is a feature I wanted for a project, and I knew roughly how to wire up all the lifetimes and mutability in Reference, but am happy to close out in favor of whatever you have.

Nah man don't worry. Don't close it. I'll review the PR and let you know if any comments. Next time it would be good to ask so we won't be repeating efforts and we can grow this faster🤟🏻🤩

MoSafi2 pushed a commit to MoSafi2/mojo that referenced this issue Apr 15, 2024
Change `Optional.value()` to return a `Reference` to `T` rather than `T`.  

Fixes modularml#2179.

Signed-off-by: Lukas Hermann <lukashermann28@gmail.com>
MoSafi2 pushed a commit to MoSafi2/mojo that referenced this issue Apr 17, 2024
Change `Optional.value()` to return a `Reference` to `T` rather than `T`.  

Fixes modularml#2179.

Signed-off-by: Lukas Hermann <lukashermann28@gmail.com>
patrickdoc added a commit that referenced this issue May 2, 2024
…) (#38062)

Change `Optional.value()` to return a `Reference` to `T` rather than
`T`.

Fixes #2179.

Signed-off-by: Lukas Hermann <lukashermann28@gmail.com>

mojo-orig-commit: a904b34

---------

Co-authored-by: Lukas Hermann <lukashermann28@gmail.com>
Co-authored-by: Joe Loser <joe@modular.com>
MODULAR_ORIG_COMMIT_REV_ID: c07cde56dac507b04d8e9c1de83c82f63f3cae90
@ematejska ematejska added the mojo-repo Tag all issues with this label label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-stdlib Tag for issues related to standard library
Projects
None yet
Development

No branches or pull requests

4 participants