Menu

#2036 Dynamically created plain class has no NEW class method

5.2.0
open
nobody
None
none
5
2025-11-05
2025-11-05
No

Using NEW to create a new class from .Class has not a NEW class method itself such that one cannot create instances from it.

Example:

clz=.class~new("Dynamically Created Class")
say "clz           :" clz
say "clz~superclass:" clz~superclass
say "clz~metaclass :" clz~metaclass
say
o=clz~new      -- create new instance
say "o:" o

Output:

clz           : The Dynamically Created Class class
clz~superclass: The Object class
clz~metaclass : The Class class

     6 *-* o=clz~new      -- create new instance
Error 97 running G:\tmp\orx\jlf\20251101_init_protocol\class\test.rex line 6:  Object method not found.
Error 97.1:  Object "The Dynamically Created Class class" does not understand message "NEW".

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB