[Info-vax] Objects and Memory (was: Re: September 6, 2016 - new Roadmap and State of the Port updates now on VSI website)
Stephen Hoffman
seaohveh at hoffmanlabs.invalid
Fri Sep 9 09:32:37 EDT 2016
On 2016-09-09 01:54:54 +0000, David Froble said:
> If there is a problem, then it is a stupid problem. I can allocate
> memory from Macro-32, and deallocate it from Basic. Or the opposite.
> Or substitute any of the VMS languages. So what's the problem? They
> are still using VMS services to do the job, right?
This is a level or two above the virtual memory allocation routines.
C can differ around the internal structures of some C-specific data
structures, with the same compiler and the same run-time, given the
possibility of different settings within that environment. That is,
you might get one layout of a particular data structure returned from a
library call, and a different structure with a different compilation
mode. Existing OpenVMS C, BASIC and Fortran programs don't generally
tolerate these sorts of changes at run-time, and would usually
minimally need to be recompiled and relinked to contend with the
differences.
It's the C equivalent of encountering different RECORD or MAP
structures for certain data returned from BASIC or Fortran (or OpenVMS
system calls, for that matter).
This is the same problem that led to OpenVMS development adding
parallel data structures for RMS changes; the NAM and NAML, among
others. Also the same problem that led to the creation of 64-bit
descriptors, to parallel system service APIs and related baggage, as
part of 64-bit addressing.
Neither C nor BASIC nor the OpenVMS version of Fortran or COBOL (nor
the OpenVMS APIs) are what's called "object-oriented" or OO. An OO
design would help mask some of these details and make changes easier.
It's a different approach than descriptors and itemlists — arguably a
descendent of these data structures and techniques — where the specific
contents and organization of the structures passed around are masked
from the application developer, and the developer receives and passes
around the addresses of blobs of data — "objects" — and can query those
blobs for specific details at run-time.
Moving to OO also usually means adding garbage collection of some sort;
automatic reference counting or otherwise, as otherwise the developer
is left to manage the lifetime of objects. C already requires that,
as does direct use of the OpenVMS VM allocation calls, as well as
allocating storage dynamic string descriptors and such.
--
Pure Personal Opinion | HoffmanLabs LLC
More information about the Info-vax
mailing list