From ab06ed825a972e5f6a75d131f356a01d9880cc7b Mon Sep 17 00:00:00 2001 From: leviongit Date: Tue, 3 Mar 2026 13:49:03 +0100 Subject: [PATCH 1/2] change wording of the "overloading" section the previous wording may have been taken as mruby not permitting the overloading of operators on any class --- doc/guides/language.md | 10 +++++----- doc/limitations.md | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/guides/language.md b/doc/guides/language.md index 93bb1de6d..329808b51 100644 --- a/doc/guides/language.md +++ b/doc/guides/language.md @@ -371,15 +371,15 @@ Fibers cannot cross C function boundaries. You cannot yield from a fiber inside a C-implemented method. Only `mrb_fiber_yield` at function return is supported. -### Array Subclasses +### Array and String Subclasses -`Array` does not support instance variables to reduce memory. This -means subclassing `Array` and adding `@fields` will raise an error. +`Array` and `String` does not support instance variables to reduce memory. +This means subclassing `Array` or `String` and adding `@fields` will raise an error. ### Operator Overriding -Operators cannot be overridden by user code. Redefining `+` on -`String` has no effect on the behavior of the `+` operator. +Operators of primitive classes cannot be overridden by user code. +Redefining `String#+` has no effect on the behavior of the `+` __operator__. ### Module Loading Hooks diff --git a/doc/limitations.md b/doc/limitations.md index 953591b08..63dbe53c6 100644 --- a/doc/limitations.md +++ b/doc/limitations.md @@ -111,7 +111,8 @@ Syntax error ## Operator modification -An operator can't be overwritten by the user. +Operators on some of the primitive classes cannot be overriden, as they are +optimized in the VM. ```ruby class String From 87f88a1ce821d0a861a260aabd701f336b89eede Mon Sep 17 00:00:00 2001 From: leviongit <31215447+leviongit@users.noreply.github.com> Date: Tue, 3 Mar 2026 13:58:23 +0100 Subject: [PATCH 2/2] fix grammar Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- doc/guides/language.md | 2 +- doc/limitations.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/guides/language.md b/doc/guides/language.md index 329808b51..81627dbfe 100644 --- a/doc/guides/language.md +++ b/doc/guides/language.md @@ -373,7 +373,7 @@ function return is supported. ### Array and String Subclasses -`Array` and `String` does not support instance variables to reduce memory. +`Array` and `String` do not support instance variables to reduce memory. This means subclassing `Array` or `String` and adding `@fields` will raise an error. ### Operator Overriding diff --git a/doc/limitations.md b/doc/limitations.md index 63dbe53c6..575ddf00b 100644 --- a/doc/limitations.md +++ b/doc/limitations.md @@ -111,7 +111,7 @@ Syntax error ## Operator modification -Operators on some of the primitive classes cannot be overriden, as they are +Operators on some of the primitive classes cannot be overridden, as they are optimized in the VM. ```ruby