Skip to content

Conversation

@dearblue
Copy link
Contributor

@dearblue dearblue commented Oct 9, 2022

mrb_funcall_id() is an attractive and easy-to-use function, but it requires more stack space. This is because the mrb_funcall_id() function takes variable-length arguments and also requires copying to a fixed-length array.

If the mrb_funcall_argv() function is called directly, stack consumption can be avoided. However, it requires an array to be defined, making it less usable.

Therefore, the MRB_FUNCALL() macro function is introduced to improve usability. This is for internal implementation at this time, because if the number of arguments is wrong, the error will be hard to understand at compile time.

Currently, only calls with up to 4 arguments are made. For reserve purposes, calls with up to 6 arguments are valid. Calls with 7 to 13 arguments will output a "function not defined" error at compile time. For 14 or more arguments, a seemingly inexplicable error is output.

@dearblue dearblue requested a review from matz as a code owner October 9, 2022 13:40
`mrb_funcall_id()` is an attractive and easy-to-use function, but it requires more stack space.
This is because the `mrb_funcall_id()` function takes variable-length arguments and also requires copying to a fixed-length array.

If the `mrb_funcall_argv()` function is called directly, stack consumption can be avoided.
However, it requires an array to be defined, making it less usable.

Therefore, the `MRB_FUNCALL()` macro function is introduced to improve usability.
This is for internal implementation at this time, because if the number of arguments is wrong, the error will be hard to understand at compile time.

Currently, only calls with up to 4 arguments are made. For reserve purposes, calls with up to 6 arguments are valid.
Calls with 7 to 13 arguments will output a "function not defined" error at compile time.
For 14 or more arguments, a seemingly inexplicable error is output.

Also, `mrb_static_assert_expand()` has been renamed to `MRB_VA_EXPAND()` and moved to `include/mruby/common.h`.
@dearblue
Copy link
Contributor Author

Also, mrb_static_assert_expand() has been renamed to MRB_VA_EXPAND() and moved to include/mruby/common.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant