by pjmlp · 9y ago · 0 comments
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n267...
Also, there are the C++/CLI and C++/CX that support GC at language level.
Now std::*_ptr<> types don't count to make the language GC, because their use is not enforced by the compiler.
We're talking about garbage-collected languages (and "language" traditionally includes the standard library), not garbage-collected-only languages.
I mean, by your definition, C# also doesn't count, because it has unmanaged pointers in it.
In C#, GC is part of the language semantics and its interaction with unmanaged pointers is well defined in the language semantics standard, including how the memory is pinned when unmanaged pointers need to access GC allocated memory.
If reference counting is a kind of GC, and the standard library offers reference counting, then the language offers a kind of GC - same as if the language itself had a built-in refcounted pointer. There's simply no practical difference here.
It only makes sense to talk like that, if the language semantics define a relationship between the language and library requiring the library to always exist as a form of runtime and how the use of that runtime relates to language constructs.
If I can just throw away the library and replace it by something else where those types aren't available and still make use of 100% of the language features, this relationship doesn't exist.
Then you also shouldn't say that Swift is garbage collected.
C++ language definition doesn't give any special treatment tostd::*_ptr<> types regarding compiler semantics. They could be be something else.