Since presym is now mandatory, mruby.h includes presym.h so that
MRB_SYM() macros are available everywhere without explicit include.
Remove redundant #include <mruby/presym.h> from all source files.
Co-authored-by: Claude <noreply@anthropic.com>
Replace XML-style markup tags in comments with markdown equivalents:
- <code>...</code> to `...` (inline code)
- <tt>...</tt> to `...` (teletype/monospace)
- <i>...</i> to *...* (italics/emphasis)
- +...+ to `...` (parameter/variable references)
Updated 80+ files across core source, headers, mrbgems, and libraries
to use consistent markdown formatting in documentation comments.
Handled edge cases including special characters like <=> operators.
Co-authored-by: Atlassian Rovo Dev
Added complete call-seq documentation for 4 missing public methods in the
data gem, improving documentation coverage from 46% to 77%.
Documentation added:
- Data.members: Returns array of member symbols for the class
- Data.define: Creates new data instances with positional or keyword arguments
- Data#initialize: Initializes data structure with hash values
- Data#initialize_copy: Copies data structure for dup/clone operations
Each method now includes:
- Clear method signatures with parameter and return types
- Detailed descriptions of data structure behavior
- Practical examples showing usage patterns
- Notes about member access and initialization
- Cross-references between class and instance methods
Co-authored-by: Atlassian Rovo Dev
When calling `mrb_equal()` or `mrb_funcall()` family functions, the GC arena should be restored if the loop is repeated by a non-immediate return value.
In my opinion, restoring the GC arena is unnecessary when a non-immediate (true) value causes the function to return (e.g. the `mrb_ary_index_m()` function).
The patch does not take into account the case of recursive calls and may be incomplete.
If `Class#allocate` is prohibited, subclasses should also be implicitly prohibited.
```ruby
p Class.new(Struct).allocate.class
# => #<Class:0x82362ac00> by #6122
# => allocator undefined for #<Class:0x000000083a983220> (TypeError) by Ruby 3.2
```
Added `MRB_DEFINE_ALLOCATOR()` to allow subclasses to use `Class#allocate`.
Supplement to #6122.
The method introduced by #5979 causes a fault by swapping classes.
```console
% bin/mruby -e 'Method = Proc; p Object.method(:inspect)'
zsh: segmentation fault (core dumped) bin/mruby -e 'Method = Proc; p Object.method(:inspect)'
```
After applying this patch, a `TypeError` exception will be raised.
```console
% bin/mruby -e 'Method = Proc; p Object.method(:inspect)'
trace (most recent call last):
[1] -e:1
-e:1:in method: allocation failure of Proc (TypeError)
```
However, if the `mrb_vtype` is the same object, the same care must still be taken as before.
```console
% bin/mruby -e 'Method = Binding; p method(:puts).eval("12345")'
trace (most recent call last):
[1] -e:1
-e:1:in eval: wrong argument type nil (expected Proc) (TypeError)
```
Calling `Class#allocate` with `UnboundMethod#bind_call` usually succeeds without problems.
If this behavior does not make us happy, we can now prohibit it with `MRB_SET_INSTANCE_TT(klass, MRB_TT_UNDEF)`.
At the same time, it applies to the `Binding`, `Complex`, `Data`, `Float`, `Integer`, `Method`, `Rational` and `UnboundMethod` classes.
- raise ArgumentError if arguments size differs from data size.
Previously it accepted smaller argument size.
- the message is updated to "wrong number of arguments". It's not
"struct" any longer.