|
I asked Barbara Moris 20+ years ago if ILE RPG might ever become an
object-oriented language. At that time she indicated that it was a subject
of debate within IBM.
She however suggested that I might enjoy writing service programs which
exported procedures pertaining to objects, including a procedure for
instantiating new objects. The "new()" procedure would use %alloc() to
return a pointer to a data structure, which contained all the object
properties (data-structure sub-fields).
For example, if the "object" were a "stream file", you might instantiate a
stream file using a procedure named perhaps stmfNew(), which would return a
pointer to a data structure instantiated via %alloc(). Internally, I might
name that data structure "stmf", and include all its attributes, such as
the IFS file name pertaining to it.
After writing a "new()" procedure, write other procedures which include a
parameter for passing an "object" reference, which would be the pointer to
that allocated data structure.
Bottom line is that while ILE RPG may not have all the characteristics of
an OO language, you as a programmer can do OO things with ILE RPG, if you
like that approach.
Every time a new() procedure is called, I store the pointer returned from
%alloc() in an internal linked list, which provides a means of deallocating
any data structures that may have been instantiated during the use of the
service program.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.