logoalt Hacker News

melodyogonna • today at 5:26 PM • 1 reply • view on HN

Mojo's origin can represent a lot of these semantics. I think a lot was learned from Nick's proposal, even if it wasn't directly implemented. Here is an example of how you could represent the first snippet, where two references can update the same list: https://godbolt.org/z/78bhzWjYM


Replies

verdagon • today at 5:41 PM

Unfortunately, Mojo kind of limits itself by forcing all parameters to be unique references or shared references. So the first example works in Mojo, but not the `step` example nor the `attack` example from the original group borrowing explanation. [0]

I hope they one day upgrade to full group borrowing, it would be a nice fit for them.

[0] https://verdagon.dev/blog/group-borrowing