GNOME Bugzilla – Bug 595323
Add "system" module which has a binding "gc"
Last modified: 2010-01-25 22:49:29 UTC
It's very convenient to be able to initiate garbage collection from a JS context. In the future I could imagine other stuff in this module roughly along the lines of Java's "System", but for now just GC.
Created attachment 143255 [details] [review] Add "system" module which has a binding "gc"
Hmm isn't this the same as bug# 593215 ?
Oops, yes...let's dup that one on this.
*** Bug 593215 has been marked as a duplicate of this bug. ***
Created attachment 143828 [details] [review] Add "system" module which has "gc" and "addressOf" "gc": It's very convenient to be able to initiate garbage collection from a JS context. "addressOf" is mainly going to be useful for printf debugging; i.e. being able to answer "Ok, what [Object object] is this"?
You forgot to add the files, the patch is only Makefile changes
(In reply to comment #6) > You forgot to add the files, the patch is only Makefile changes I had to leave something as an exercise for the reader... =)
Created attachment 143833 [details] [review] Add "system" module which has "gc" and "addressOf" "gc": It's very convenient to be able to initiate garbage collection from a JS context. "addressOf" is mainly going to be useful for printf debugging; i.e. being able to answer "Ok, what [Object object] is this"?
+ if (!JS_DefineFunction(context, module_obj, + "gc", + gjs_jssystem_gc, + 1, GJS_MODULE_PROP_FLAGS)) Should be 0 I believe The style is not consistent, the function implementation should use an indentation of 4 spaces Looks to me otherwise
Comment on attachment 143833 [details] [review] Add "system" module which has "gc" and "addressOf" >+system_la_LIBADD = \ >+ libgjs-gi.la \ >+ $(JS_NATIVE_MODULE_LIBADD) libgjs-gi shouldn't be needed if the module doesn't use introspection. Isn't libgjs.la enough?
Let's skip this for now, I don't want to add highlevel imports at random. It was easier for me to just define it inside Shell. We should look to Common JS for module inspirations if someone wants to revisit adding a System module like.