Re:Clay 0.1.0 - Clay Programming Language
by niyazpk on Tuesday January 17, 2012 @09:06AM
(#3474909)
Can somebody elaborate on what "No garbage collection" means? What are the implications?
[ Parent
| on HN ]
It means that you have to make sure to deallocate any memory you allocate when you are done with it. Basically, the same as C and C++, as opposed to garbage-collected languages like Python or Java, which will automatically detect when you are done with a chunk of memory and deallocate it for you.
It's quite refreshing to see a new language that doesn't have garbage collection. Memory leaks have always been less of a problem for me than the kind of performance hit GC can cause (particularly in games).
Re:Clay 0.1.0 - Clay Programming Language
by lemming on Tuesday January 17, 2012 @11:42AM
(#3475411)
Does the type system help out in any way with this? I know linear types can be used to enforce memory management, but IIRC (I haven't looked recently) Clay's type system was more oriented towards generics than this sort of strictness.
Re:Clay 0.1.0 - Clay Programming Language
by jckarter on Tuesday January 17, 2012 @12:12PM
(#3475533)
You're correct; Clay's type system doesn't help much with memory safety. It's flexible enough to express RAII-based ownership semantics like C++, so you can manage dynamic memory with reference counted, uniquely-owned, or other policy-enforcing pointer objects, but also like C++, the language doesn't prevent you from taking nonowning references to arbitrary data behind the type system's back and using those references after the owning object has freed the data.
This is a strong statement for a language to make, but it actually makes it much more interesting.
To me, this says "Clay should be used to implement the same kind of hard-core stuff that is still implemented in C++": games, interpreters, compilers, browsers, etc.