3 ms·
IIUC, python's sub-interpreters won't have a `move`. That might not be a bad idea because I am worried `move` will end up being problematic in ruby, but time w
by riffraff 7y ago
IIUC, python's sub-interpreters won't have a `move`.
That might not be a bad idea because I am worried `move` will end up being problematic in ruby, but time will tell.
- AlexTWithBeard 7y agoCopy + move looks like a typical function call to me: pass in a bunch of immutable arguments, return a result. Such approach would cover many, if not most user cases for multithreading.
- rocqua 7y agoWhat happens when the caller modifies the read only arguments while the function is running?
- pmontra 7y agoI'm not sure if this the question you're asking but in Ruby the program fails. gsub! is a method of String that mutates the object (vs gsub which returns a new string) freeze is a method that makes immutable the object it's called upon. 2.3.0 :001 > def replace_a_with_b(s) 2.3.0 :001?> s.gsub!("a", "b") 2.3.0 :001?> end => :replace_a_with_b 2.3.0 :002 > replace_a_with_b("abc") => "bbc" 2.3.0 :003 > replace_a_with_b("abc".freeze) RuntimeError: can't modify frozen String from (irb):20:in `gsub!' from (irb):20:in `replace_a_with_b' from (irb):23 from /home/me/.rvm/rubies/ruby-2.3.0/bin/irb:11:in `<main>'
- XMPPwocky 7y agowait, so you can either have one "owner" and transfer ownership between domains (via move) or have shared, but immutable, ownership? Hm. Who let the Rust folks in?
- pmontra 7y agoLanguages cross pollinate. Eventually every language going through the message passing route will reimplement the Erlang VM and OTP...
- jashmatthews 7y agoYeah, I’d much prefer a traditional sub interpreter or isolate design with shared nothing than the current „raise an exception if shared non frozen objects are touched“. It’s much easier to map existing multi process code onto shared nothing sub interpreters.
- Animats 7y agoMove is hard without ownership. Rust can do moves because it knows that there's nothing else pointing to the thing being moved. Python doesn't know that.