On 10/19/2015 08:32 PM, Tom Tromey wrote: > Daniel> A runtime describes Emacs as a whole. It lives forever and has > Daniel> no thread affinity. > > Thanks. > > Daniel> We have a perfectly good sentinel: NULL. NULL will never be a valid > Daniel> local or global reference, so it's safe to use it to indicate that > Daniel> something went wrong. > > Ok, I see, it really is JNI. I was confused because the module API > doesn't implement this. Sure, although I'd like it to. If we use the currently-implemented approach, it's not a disaster. It'd just be a shame to have to cart around long long values on 32-bit platforms even when Emacs is compiled with plain 32-bit values. > This design seems a bit odd for Emacs in that "immediate" things like > ints will still have to be wrapped in references. Right, because we're not strongly typed like Java. The references are cheap enough though, and there's no awkardness around pointer width or type tagging. Once we get a numeric tower, it'll be possible to store a full 32 bits in an emacs_value without having to be aware that there's an indirection. This approach also completely insulates us from GC changes: we could even implement a compacting collector without modules being aware of it. FWIW, it's not just JNI. V8 works the same way.