@mtrasim I've already said it's a bad idea (even on many architectures on which it's possible). And even if you don't really have a heap, it doesn't mean you couldn't use dynamic memory if a language supports custom allocators. You can provide a memory pool on a stack, that's what I actually did in the VM I mentioned.
allocShared, just like I said. But can I make sure about why you use both dataRef and data fields? data is a public pointer to the data so I guess you'd like to have raw access to the fixed location (what a constant pointer in C would do). But then, as far as I know, you can reassign data field to another location? I guess an inlined getter would be better. The same for len as you can definitely reassign it, breaking all the assertions (in general case you'll end up desynchronizing copies). Also: a deep copy will make a copy of the ref object, i.e. a ptr. So the _[actual](https://forum.nim-lang.org/postActivity.xml#actual) data won't be copied and so you end up with two semantically different objects which point to the same data. Both can possibly try to deallocate it then. Not a really good idea, as not only this object can't be properly deepCopied but does it quite wrong. You'd need to provide a separate type (not just ptr T) instead so you could overload deepCopy. As you can see, it's not as trivial as your example. Also: I don't think you'd like to reimplement seq and all the other standard containers for them to use shared heap? Especially considering it being non-trivial, as I proved to you?
