4 ms·
> It wouldn't weirdly copy the entire object over and over again, it would directly manipulate the object, one piece at a time. I think this is the only part I
by wtetzner 4y ago
> It wouldn't weirdly copy the entire object over and over again, it would directly manipulate the object, one piece at a time.
I think this is the only part I disagree with. Immutable data types make it much easier to understand code, because everything is local. You don't have to worry that some other part of the code base might have a reference to this object, and could be manipulating it out from under you.
- john_the_writer 4y agoIn practice this doesn't really happen in the context of a function call. Like calling do_something(object) might call something inside it that changed the object, but not likely unknown.. Now if you're talking about threading. Honestly, I worked as a c++, java, rails and now elixir dev for > 20 years. I can't tell you how many times I built something that threaded, but not all that often. It's just doesn't come up all that often.
- Tainnor 4y agoIn all likelihood whatever web frameworks you're using in the languages you used will use concurrency in order to be able to serve different requests at the same time. In some languages, that will mean some sort of event loop, but more often than not it will also be done via threads. Just because you create them yourself doesn't mean they aren't there.