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


  • Subject: RE: Runtime KLIST change?
  • From: "David Morris" <dmorris@xxxxxxxxxxxxx>
  • Date: Mon, 06 Dec 1999 10:05:35 -0700

Hans,

In October Midrange Computing published a set of procedures 
that support dynamic storage allocation. The code uses a combination 
of user index and Heap/user space/*LDA storage. Are you saying that 
the problem with deallocation is that there is no easy way to know when 
storage is no longer in use? If register exit or scope messages supported 
a call level, it seems like it would be much easier provide this type of 
function in RPG.

David Morris 

>>> boldt@ca.ibm.com 12/06/99 06:53AM >>>

Excellent point.  Pointers are a very low level concept in any
language.  (Pointers are the "goto" of data structures!)
Pointers are best used within a higher-level abstraction.  When
implementing some higher-level data structure, such as a linked
list or tree, the user of such a data structure shouldn't have
to know anything about how pointers work.

Here's an example:  You could have a service program that
implements a linked list.  One procedure would "create" the
linked list and return a "reference" (really a pointer) to the
data structure.  That reference would be passed by the user to
all other procedures within that service program.  The other
procedures would handle searching, insertion, iteration, and
deletion operations on one particular linked list.  In fact,
this is almost, sort of like object-oriented programming!

In practice, though, even if you take this style of object-
based design, the users of such a high-level data structure
really can't get away completely from understanding how
pointers work.  In this case for example, for the linked list
service program to be completely general, you'd have to deal
with references to the data in each node of the list.  This
would be fine if the data in each node were also some form of
high-level "object", but for standard RPG data types, you'd
need at least to define some based variables in your program.

(Actually, lately, I've been toying with the idea of how to
implement some form of real object-oriented programming in
RPG without having to add any language enhancements by
extending the approach described above.  Almost everything
could be handled relatively easily except for the
deallocation of object storage.)

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com 


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.