Re: Detecting whether a module was imported or not

2018-02-02 Thread cdome
Could be worth trying to go throw list of loaded DLLs, shared objects in the current process?

Re: Detecting whether a module was imported or not

2018-02-02 Thread Stefan_Salewski
Araq, I think I can understand his intention: He wants to use nre module only, if it is used by other foreign modules already. Maybe to not unnecessary blow total executable size or to not introduce more new dependencies. Maybe, he has the task to search for a substring, so when nre is used alr

Re: Detecting whether a module was imported or not

2018-02-02 Thread Araq
That's not how the import mechanism works, even if some other code imports `nre`, it's not in your scope. You can check for `when declared(nre)` in your code to see if you imported it on your own (if you have setup some complex `include` files this can be useful).

Detecting whether a module was imported or not

2018-02-01 Thread CarlosH
In my module, I'd like to do something like when defined(nre): import nre # code that works with regular expressions so, if the user does import nre import my_module then that code gets compiled, but if the user doesn't use nre, then we aren'