I have a procedure verify_isbn_number() which uses a regular expression (“core:text/regex”) to test the validity of the ISBN number.
I can declare (and destroy) the regex in the procedure itself (no problem) but I was wondering about defining the regex at as package variable, initialize it with an init (@init) procedure and destroy it with a fini (@fini) procedure. The problem is that init and fini procedures must be contextless which means memory allocation in these is not recommended (if not why force them to be contextless).
I have seen a couple of comments (including Odin Issue #91 whic provides a workaround (#+feature global-context) but this is noted as temporary. Still looks lie, long term, allocation in the init/fini procedure is discouraged. (And I have seen the other workaround context = runtime.default_context()).
My question is 1) Is there a blog entry or other discussion explaining why allocating in the init/fini procedure is not recommended and 2)Is there an alternate solution to have a regex as a package variable that I missed?
Thanks