You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let string = RString::new("Some string");letmut array = Array::new();// Moves `string` into `array` similarly to `vec.push()` in Rust
array.push(string);// ... `string` cannot be used, because it's moved
vs
string='Some string'array=[]# Takes a reference of the `string`array.push(string)# `string` can be usedstring.concat(" mutated")array.inspect# => ['Some string mutated']
It needs to be decided whether to take objects references (Ruby way) or by values (Rust way).
The text was updated successfully, but these errors were encountered:
I think having the Rust way is preferable. We can manage the context of ownership like we normally would in Rust. We can let each language behave in their own way and this won't lead to surprises. I like being able to define the ownership in my own programs.
Consider the following example:
vs
It needs to be decided whether to take objects references (Ruby way) or by values (Rust way).
The text was updated successfully, but these errors were encountered: