7 Replies
Yes. You can simply use
ReferenceThanks, I saw that, but it wasn't clear to me: is
Reference compiled to a simple pointer, or is it some reference-counted thing?It's a pointer (with lifetime tracking). For ref-count, you may use
Archttps://github.com/modularml/mojo/blob/main/proposals/lifetimes-and-provenance.md
I was reading this and it said that it's "impossible to return references." Is this doc outdated then?
GitHub
mojo/proposals/lifetimes-and-provenance.md at main · modularml/mojo
The Mojo Programming Language. Contribute to modularml/mojo development by creating an account on GitHub.
Ah, this proposal has already been implemented for a while now. This is design doc, so I won't say it's outdated per se, but it indeed describes an older state of the language.
Got it, thanks 🙂
I think we are indeed lacking in documentation regarding
Reference etc. So, if you see any thing you want to be explained better, you could raise an issue on GH to help the team prioritize.