Commit Graph

16817 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto e9d20a1590 doc/limitations.md: document double dispatch removal
We have removed `append_features`/`prepend_features`/`extend_object`.
It is incompatible with CRuby, but simpler.
2025-04-28 10:30:01 +09:00
Yukihiro "Matz" Matsumoto 6c72f8b378 class.c (extend_object): remove method; implement Kernel#extend in C 2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto 6c25b5896a class.c (prepend_features): remove the method
Just like `#append_features`, we remove `#prepend_features` and
implemented `#prepend` directly in C.
2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto 9387cd382e class.c (append_features): remove the method
The technique is called "double dispatch" (that was popular in
Smalltalk), but it does not work well with mruby. It's slower and
consumes more memory. Even thought `#append_features` defined in ISO
standard (15.2.2.4.11), we decided to remove it. Strictly speaking, it
is mruby limitation. And it should be documented clearly.
2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto 5fe406d59c vm.c (send_method): should not use C++ keyword public 2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto a6ef3a45d1 vm.c (mrb_f_public_send): define #public_send method
The method itself is available when mruby-metaprog is loaded.
2025-04-25 17:39:12 +09:00
Yukihiro "Matz" Matsumoto dd96afd5a8 variable.c (mrb_const_set): call const_added hook 2025-04-25 16:25:36 +09:00
Yukihiro "Matz" Matsumoto e5478c2b40 class.c (setup_class): simplified using mrb_const_set() 2025-04-25 16:23:02 +09:00
Yukihiro "Matz" Matsumoto 8f120971b5 variable.c: merge mrb_vm_const_set to mrb_const_set
Inline vm part to the VM itself.
2025-04-25 16:12:06 +09:00
Yukihiro "Matz" Matsumoto 03719490eb class.c: define const_added method (with empty body) 2025-04-25 15:56:57 +09:00
Yukihiro "Matz" Matsumoto 6e1538ce3a Merge pull request #6518 from HirohitoHigashi/master 2025-04-25 15:51:36 +09:00
Yukihiro "Matz" Matsumoto 279855985f Merge pull request #6517 from jbampton/remove-unneeded-semicolon 2025-04-25 15:46:14 +09:00
HirohitoHigashi 586ff7a694 Change mrbc_args.flags bit width from 2 to 3. 2025-04-25 12:05:01 +09:00
John Bampton fe201dc72f core/codegen.c: remove unneeded duplicate semicolon 2025-04-25 05:10:24 +10:00
Yukihiro "Matz" Matsumoto 9c6349c769 Merge pull request #6513 from mruby/stable 2025-04-21 13:57:27 +09:00
Hiroshi Mimaki d4097716b3 NEWS: remove wrong spelling from the pull-request description 2025-04-21 10:24:03 +09:00
mimaki 99f5668243 Merge branch 'master' into stable 2025-04-20 13:25:22 +09:00
mimaki a309524d0b Update version and release date. (mruby 3.4.0 (2025-04-20)) 3.4.0 2025-04-20 13:08:22 +09:00
Yukihiro "Matz" Matsumoto baea6e284e mruby-bigint (mpz_bits): use lzb() 2025-04-17 08:11:27 +09:00
Yukihiro "Matz" Matsumoto 061521ead5 mruby-bigint (mpz_bits): renamed from mpz_bit_length() 2025-04-17 08:10:34 +09:00
Yukihiro "Matz" Matsumoto 16198dc985 mruby-numeric-ext (int_sqrt): translate Japanese comment (oops) 2025-04-17 01:43:03 +09:00
Yukihiro "Matz" Matsumoto e42523fcf4 mruby-numeric-ext: add test for Integer.sqrt() 2025-04-16 23:30:23 +09:00
Yukihiro "Matz" Matsumoto ddfe65763e mruby-numeric-ext (int_sqrt): support bigint 2025-04-16 23:08:23 +09:00
Yukihiro "Matz" Matsumoto dee661913f mruby-numeric-ext (int_sqrt): Integer.sqrt implemented
This is the first version. It should support bigint eventually.
2025-04-16 22:37:06 +09:00
Yukihiro "Matz" Matsumoto 9a0f96e617 pre-commit autoupdate 2025-04-16 22:34:27 +09:00
Yukihiro "Matz" Matsumoto 8b213c4fbf string.c (sub_replace): check if found argument is within proper range
Since it is an internal method, we didn't check the argument range, but
if it's called directly, out-of-range argument could cause SEGV.
2025-04-15 07:11:09 +09:00
Yukihiro "Matz" Matsumoto 9cc6d39956 test/module.rb: add test for #6506 2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto 1969100fb4 variable.c (mrb_vm_get_const): seek singleton class superclass; fix #6506
Also ensure we don't revive #2515, #3003, #3598
2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto 953ebdf334 variable.c (mrb_vm_const_get): refactoring for singleton classes 2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto 95f9de4877 mruby-metaprog (mrb_mod_s_constants): Module.constants implemented
The method returns the list of all constants accessible from the point
of call.
2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto e08452585e variable.c (mrb_mod_cv_get): c must not be NULL as an argument 2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto 90d77e71f5 variable.c (mrb_mod_cv_set): small refactoring
The argument c should not be NULL.
2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto 118e13d85c variable.c: a new function mrb_mod_const_at()
And mrb_mod_constants() use the new function now.
2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto cda551ce25 mruby-metaprog (mrb_mod_s_constants): call Module#constants if possible
When the optional argument is given or the receiver is not `Module`.
2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto 82522a2e71 mruby-bigint (mrb_bint_to_s): add check for MRB_32BIT and MRB_INT64 2025-04-14 22:09:33 +09:00
Yukihiro "Matz" Matsumoto 29964b3ba7 mruby-io (mrb_file_size): add check for MRB_32BIT and MRB_INT64 2025-04-14 22:09:33 +09:00
Yukihiro "Matz" Matsumoto 0d5fecf833 variable.c (mrb_const_get): adjust local variable scope 2025-04-14 22:09:33 +09:00
Yukihiro "Matz" Matsumoto 52de3b7e10 Merge pull request #6511 from dearblue/precommit
Exclude the external project "lrama" from pre-commit
2025-04-08 23:44:31 +09:00
dearblue 40095bf755 Exclude the external project "lrama" from pre-commit 2025-04-08 22:11:32 +09:00
Yukihiro "Matz" Matsumoto 46aa35a117 Merge pull request #6510 from dearblue/visibility
Fixed class method visibility via `module_function`
2025-04-08 17:18:19 +09:00
dearblue 84e1b0045c Fixed class method visibility via module_function
The following code should work

```ruby
module M
  def me
    p self
  end

  module_function :me
end

M.me
```
2025-04-07 21:40:56 +09:00
Yukihiro "Matz" Matsumoto 1fdd961041 mruby-compiler (scope_new): need to initialize nregs; fix #6509
`nregs` should not be smaller than `nlocals`.
2025-04-07 11:35:19 +09:00
Yukihiro "Matz" Matsumoto 8c2ea232ea Revert "mruby-enum-ext (cycle): need to splat block parameters; #6508"
This reverts commit 6c4b799b42.
2025-04-07 08:23:52 +09:00
Yukihiro "Matz" Matsumoto 6c4b799b42 mruby-enum-ext (cycle): need to splat block parameters; #6508 2025-04-06 22:05:57 +09:00
Yukihiro "Matz" Matsumoto 96855d31b5 mruby-enum-ext (sum): need to honor index; fix #6508 2025-04-06 22:04:56 +09:00
Yukihiro "Matz" Matsumoto dd68681002 mruby-enum-ext: tally should respect multi-values; fix #6507 2025-04-05 22:12:51 +09:00
Yukihiro "Matz" Matsumoto cb8cd9388c mruby-enum-ext: filter_map should not ignore index; fix #6504 2025-04-05 21:44:49 +09:00
Yukihiro "Matz" Matsumoto 9750513c25 mruby-bigint (mpz_get_str): add type cast to stop warning 2025-04-04 23:55:44 +09:00
Yukihiro "Matz" Matsumoto bf36ba9d10 Merge pull request #6505 from jbampton/fix-spelling
mrbgems: fix spelling
2025-04-04 17:33:32 +09:00
John Bampton b1d910f6f4 mrbgems: fix spelling 2025-04-04 15:05:13 +10:00