4 ms·
>>if a pure function (or block) regards all previously existing memory as one immutable region, it doesn't matter if there was any mutable aliasing happening be
by phkahler 5y ago
>>if a pure function (or block) regards all previously existing memory as one immutable region, it doesn't matter if there was any mutable aliasing happening before, because everything inside that region is shared and immutable now.
Pure functions don't usually need any of this. If they are handed a pointer it has to be to immutable data or not shared by another thread.
- verdagon 5y agoC++ doesn't have a concept of immutable data, or data not shared by another thread, which is part of the challenge. This "region borrow checker" aids the former; we can call a pure function that can regard previously shared-mutable data as temporarily immutable.
- fivea 5y ago> C++ doesn't have a concept of immutable data, or data not shared by another thread, which is part of the challenge. Does it really need it, though? In the real world C++ apps already use higher-level constructs to handle this sort of semantics. For instance, Qt offers it's moveToThread member function to specify thread affinity. What problem does this actually solve?