From: tagomoris@... Date: 2017-12-12T12:16:35+00:00 Subject: [ruby-core:84208] [Ruby trunk Feature#14168] C call to raise FrozenError Issue #14168 has been reported by tagomoris (Satoshi TAGOMORI). ---------------------------------------- Feature #14168: C call to raise FrozenError https://bugs.ruby-lang.org/issues/14168 * Author: tagomoris (Satoshi TAGOMORI) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Currently we need to check the object is frozen or not by `isFrozen` and raise error (RuntimeError or FrozenError) under its own responsibility. Providing such c function makes us to write much safer code/extensions. ```c /* now */ if (OBJ_FROZEN(self)) { rb_raise(rb_eRuntimeError, "can't modify frozen Factory"); } /* what I want to do */ assert_is_not_frozen("MyAwesomeClass"); // raises RuntimeError (~2.4) or FrozenError (2.5~) if it is frozen // or assert_is_not_frozen(self); // classname? self VALUE? ``` I want to reduce macros for ruby versions in out C extensions, so this feature will help us so much. -- https://bugs.ruby-lang.org/ Unsubscribe: