-
Notifications
You must be signed in to change notification settings - Fork 687
Closed
Description
module_name is stringified, which will cause the argument to not be evaluated by the preprocessor but used verbatim.
After having used the macro in practice, I found that it's not desirable to stringify it, because:
-
it prevents one from creating macros that call the
JERRYX_NATIVE_MODULEmacro and pass in a variable module name -
it makes it impossible to single-source the module name, i.e. I cannot write something like:
#define MY_MODULE_NAME my_module
#define MY_MODULE_NAME_STR STRINGIFY(MY_MODULE_NAME)
void
foo (void)
{
const jerry_value_t m = call_require(MY_MODULE_NAME_STR);
// ...
}
// module will actually be named "MY_MODULE_NAME"...
JERRYX_NATIVE_MODULE(MY_MODULE_NAME, ...)
Therefore I propose to remove the stringification (#) from the macro.
I realize it's a breaking change, but the API is pretty new and the migration path is super simple.
Thoughts @gabrielschulhof ?
cc @jiangzidong
Metadata
Metadata
Assignees
Labels
No labels