That sounds like Objective-C. One of the reasons I first liked working with Objective-C (before the iPhone made it trendy) was that it seemed like a much better-executed version of what C++ was aiming to be. It has optional garbage collection now, but only on the Mac. Its type system is even close to what Steve described in this article.
Re:The Next Big Language
by alexgartrell on Wednesday January 26, 2011 @07:06PM
(#2145909)
just curious, do you allow malloc_gc'ed items to reference malloc'd ones?
Re:The Next Big Language
by huhtenberg on Thursday January 27, 2011 @02:46AM
(#2147027)
Sure.
malloc'ed item could be the same as malloc_gc'd, but with its reference count artificially bumped up by 1. free() would decrement the count and the item will be picked up by the GC later on. If there's a provision for an immediate disposal of unreferenced items, then we are back to the standard malloc/free behaviour in case when malloc and malloc_gc items are not mixed.
Reference counting is a bad C++ substitute for a real GC.
Re:The Next Big Language
by huhtenberg on Thursday January 27, 2011 @11:51AM
(#2148493)
Sure, absolutely. Just as C++ is a bad substitute for a real language.
(edit) </sarcasm>
Also, on a tangential note -- the garbage collection is a huge deal if an adoption of the NBL among C/++ programmers is considered. The only way is to have the garbage collection optional. Similarly to how D has it, but much much simpler. Something like adding new_gc operator (or a malloc_gc function) and to have two kinds of memory blocks - manually managed and garbage collected...
Anyway, it's just a thought from an old fart camp :)