I can see two different topics here:

   1. Clearly differentiating between object creation and object
   initialization.
   2. Making all objects adhere to the "NEW passes all arguments to INI"
   idea.

As far as I can see, item 2 can be readily fixed, but we'd run into the
risk of breaking existing programs For example, TUTOR has been written
against this anomaly, and would require some changes.

We could also opt for leaving things as they are, but then it would be
imperative to document and explain the anomaly.

Regarding item 1, it would be nice if we could add a new section to rexxref
(maybe 4.2.8) called "Creation", or "Object creation". It would document
the whole process of giving birth to an object as composed of two phases,
creation and initialization. And it should explain that, in some cases, it
can be necessary (or more convenient) to process the arguments in NEW, and,
in other cases, in INIT.

Finally, we should stress on the fact that calling the INIT method for the
superclass is not mandatory in all cases, but only when the initialization
is, so to speak, distributed in several scopes. For example, in example
4.12, class Savings calls the INIT method of its superclass, because the
superclass has to store the balance, but class Account does not call the
INIT method of its superclass (in this case, Object). And, of course, if
some of the built-in classes needs that its INIT method is called by
subclasses, this should also be documented.

  Josep Maria


Missatge de Rony G. Flatscher <[email protected]> del dia dt., 4 de
nov. 2025 a les 22:48:

> 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
>
> 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

Reply via email to