On Tue, Nov 4, 2025 at 4:48 PM Rony G. Flatscher <[email protected]> wrote:
> To have all ooRexx classes adhere to "4.2.9. Initialization" (NEW sends an > INIT message to the newly created object) one could do the following: > > - check out all ooRexx classes that have NEW class methods of their > own, > > - those which do not send the INIT message get changed such that > > - the NEW method sends the INIT message to the newly created object > supplying all arguments in the same order the NEW method received > > - create an INIT method for these classes that intercept the INIT > message > > - variant 1: other then that do nothing, such that the existing NEW > code remains unchanged > > - variant 2: move the respective initialization logic from the > NEW method to the INIT method and such carry out the initialization > based > on the arguments in the INIT method > > Variant 2 isn't particularly workable for array and string because they are variable-sized objects. The new method needs to process the argument in order to allocate the object that would be the recipient of the INIT method. This also means that the new method is the one that does validation of the arguments. Rick > > > Both variants would allow subclasses to intercept the INIT message and > learn about the arguments and then do a self~init:super(...) as expected > from them. > > What do you think? > > ---rony > > > On 03.11.2025 22:32, Rony G. Flatscher wrote: > > In this context, maybe the following code review may be > interesting/important as well: > <https://sourceforge.net/p/oorexx/bugs/_discuss/thread/33b6f3d4ad/0dcd/e432/attachment/_code%20review.txt> > <https://sourceforge.net/p/oorexx/bugs/_discuss/thread/33b6f3d4ad/0dcd/e432/attachment/_code%20review.txt> > attached to <https://sourceforge.net/p/oorexx/bugs/2034/> > <https://sourceforge.net/p/oorexx/bugs/2034/> by Jean Louis Faucher. > > Also here the question how to assess these findings, and in case of bugs, > which ones and what to fix in which manner? > > @Rick: maybe you could give some insights as to why some NEW class methods > do not send the INIT message? Are these maybe oversights or intentionally > coded that way? > > ---rony > > > On 03.11.2025 14:48, Rony G. Flatscher wrote: > > rexxref.pdf states the following in "4.2.9. Initialization": > > 4.2.9. Initialization > > Any object requiring initialization at creation time must define an INIT > method. If this method is defined, the class object runs the INIT method > after the object is created. If an object has more than one INIT method > (for example, it is defined in several classes), each INIT method must > forward the INIT message up the hierarchy to complete the object's > initialization. > > The Object's NEW class method (and some other classes) adhere to this > protocol, but others like Array's NEW class method does not. > > The question is, how to asses this? Is this an error in the implementation > of e.g. the Array NEW class method, that it does not send an INIT message > to the newly created array object? And if it is an error, should all > arguments given to the NEW message be forwarded to the INIT method, or > should those argument that the NEW method uses be regarded to be consumed > and not forwarded to the newly created object? In the latter case this > would have to be documented as well. > > So, what is the take on this? > > ---rony > > > > _______________________________________________ > Oorexx-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/oorexx-devel >
_______________________________________________ Oorexx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oorexx-devel
