This seem to me why Per Vognsen said once that system programming languages should not make copying first class and instead an explicit operation
-
-
-
The question is about copying as an explicit operation.
-
That's fair.. My answer sometimes for similar issues is to establish a scope that allows to set an expectation (this amount of time, this amount of data) then warns/traces when the expectation gets violated.
End of conversation
New conversation -
-
-
I’m fond Rusts semantics for this. Your custom types have to explicitly declare copy or clone. And you can’t do either if they aren’t declared. Copy can also only be derived for types where all internal structures are themselves copyable etc.
-
And then your functions can say “take x where x is copy” and now that strict you don’t want copying can’t be passed to a function that’s gonna try to.
-
To be more specific you then don’t implement copy for certain language intrinsics. Like say list, stack, queue, ptr etc. that way if the user wants to copy them they must explicitly implement a copy function. At that point the developer has specified intent and is let them.
-
This is impractical and not really helpful .. basically the same as C++.
End of conversation
New conversation -
-
-
If your Ctrl+V lasts more than four hours, seek medical attention.
- 1 more reply
New conversation -
-
-
Copy on write
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Qt containers use reference counting and copy-on-write internally to minimize copying. a deep copy happens only when a non-const function is called (and you need to be aware of this so that you won't accidentally trigger a deep copy with e.g. a range-based for loop)
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I’m sure
@apankrat might have some experience with this sort of thing. -
I suspect Johnathan was referring to copying in-program data model objects rather than files :)
End of conversation
New conversation -
-
-
I made custom serializer in Java so I could serialize everything. I am writing the types first (so I have read instructions for deserialization), then data. Cyclic dependencies are both in structure and data. Cyclic references are detected and identified. https://github.com/Namek/artemis-odb-entity-tracker/blob/develop/README.md …
-
Of course, it's crazy to copy whole object with everything it references to, every frame, so I decided to display a tree like in any windowed debugger and download/refresh only the parts (levels of deepness) of object which are currently elapsed in UI. But that...
-
...introduces problems with performance when it comes to diffing array of objects. I have no info like "this array has changed". No IDs from Java. No immutability. Since I wanted to make a thing similar to Unity where I can see object states on live, ...
-
... I found that it would be less crazy in performance terms if I made my own language which would control such things. Or simply pick up a language with immutability buuut it's not so much gamedev friendly. I also didn't want to make any special annotations for types of fields..
-
So making this performant and transparent (plug-and-play "debugger" through network, like debugging Android game on PC) for user would really not be insane with a custom language. Which is a part of reasons why I'm huge fan of Jai language and the engine made with it.
-
Oh, let's summarize. Deep copy without any control is madness. Controlling deep copy may be much worse.
-
And oh, if anyone's interested, I had a series of blog posts on writing custom serializer: https://www.namekdev.net/tag/serializing-java/ … [disclosure] Java is absolutely not my love. libgdx was the reason, decision countering super buggy and self-destructive Unity back then. Pure (Kotlin) code.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.