× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I've been doing something similar since ILE and *SRVPGMs. A class is
nothing but two sets: a set of data structure definitions, and a set of
procedures (methods) which can operate upon them. An object is nothing but
a pointer to memory. You need a constructor (new()) and a deconstructor.
That doesn't give us all the syntactic sugar, or things like inheritance
built-in, but I don't spend a lot of time inheriting. It does give us a '
black box' which hides implementation details.
ILE/RPG isn't object oriented, but it is certainly possible to write code
that is heavily heavily oop flavored.

On Tue, Mar 14, 2023, 1:05 PM Nathan Andelin <nandelin@xxxxxxxxx> wrote:

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

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.