3 ms·
It's because "class" and "class" are referring to two difference semantics. An OO GC'd language "class" is a mechanism for run-time polymorphism. That's what i
by mjburgess 6y ago
It's because "class" and "class" are referring to two difference semantics.
An OO GC'd language "class" is a mechanism for run-time polymorphism. That's what it's for.
C++ has no "runtime" concerns of these kinds, so virtualization sits on top systems with compile-time semantics (ie., c++ classes).
- gpderetta 6y agoBut that's just an implementation detail leaking. If the GC language properly supported interior pointers (and first class pointers) for the GC there wouldn't be a need to force boxing in all cases. You would be able to make the decision at the point of instantiation of the object. It would make the GC more complex, but I think these days most GCs support interior pointers for other reason anyway, right? Or am I missing something?
- dfgdghdf 6y ago> that's just an implementation detail leaking. I feel like this is every wart in the C++ language!
- xfer 6y agoAre you talking about go-style explicit pointers? I don't know if it is worth it to add them with a different semantics and dealing with nulls when you can have value types with an attribute. Pointers as an abstraction also leak implementation detail.
- gpderetta 6y agoPointers do not need to imply nullability (C++ references are not nullable for example). On the other hand having pointers allows implementing swap().
- xfer 6y agodotnet nowadays does have reference semantics. https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/byrefs https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...