←back to thread

jank is C++

(jank-lang.org)
257 points Jeaye | 4 comments | | HN request time: 0.473s | source
1. YuriNiyazov ◴[] No.44537353[source]
A long long time ago, at ClojureConj 2014, I asked Rich Hickey whether a cpp-based clojure was possible, and his answer was "well, the primary impediment there is a lack of a garbage collector". There were a lot of conversations going on at the same time, so I didn't get an opportunity to "delve" into it, but:

1. does that objection make sense? 2. How does jank approach that hurdle.

replies(3): >>44537608 #>>44537731 #>>44537844 #
2. bertmuthalaly ◴[] No.44537608[source]
It's the first section in the article -

"I have implemented manual memory management via cpp/new and cpp/delete. This uses jank's GC allocator (currently bdwgc), rather than malloc, so using cpp/delete isn't generally needed. However, if cpp/delete is used then memory collection can be eager and more deterministic.

The implementation has full bdwgc support for destructors as well, so both manual deletion and automatic collection will trigger non-trivial destructors."

3. Jeaye ◴[] No.44537731[source]
A GC is nowhere near the most difficult part of this. In 2014, there was no viable technology for JIT compiling C++, and very little technology for JIT compiling native code in general.
4. bluGill ◴[] No.44537844[source]
In the artical - it garbage collects always but if you call delete the garbage collector will be more agressive about cleaning that up.