comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: pointers & OOP
Date: 1999/05/01
Date: 1999-05-01T00:00:00+00:00	[thread overview]
Message-ID: <372b3b54.3547130@news.pacbell.net> (raw)

In GNAT chat, John Robinson said:
> It is difficult to do anything really useful with Ada 95 OOP features
> without the use of pointers.
Robert Dewar pointed to finalization actions as just one example
of using OOP without pointers, and Matthew Heaney said:
> ... it would be helpful to have a list of typical examples.
so here's another:
  Sometimes, perhaps for task-safety or resource ownership
reasons, the task that wants something done can't do it, but
needs to ask a different service task to do the job.  Rather
than have a proliferation of 'entry's in the service task, one
per type of job, make a single service entry that takes a
"Job:in out Job_To_Do'Class" parameter and whose 'accept' merely
calls a "Do_It(Job)" procedure.  Any time some new type of job
needs to be done, simply declare a child of Job_To_Do, with
appropriate places in the record extension for parameters, and
overide procedure Do_It(Job : in out Job_To_Do).  Then a call
to the service entry will dispatch to the desired Do_It routine
so the service task will actually be the one executing the Do_It
code.  Essentially you are using Job_To_Do's dispatch table to
pass a procedure pointer, and using the record extension to
hold the parameters, but you are getting the compiler to build,
and check, everything instead of relying on screwup-able
explicit pointers.





             reply	other threads:[~1999-05-01  0:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-01  0:00 Tom Moran [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-05-01  0:00 pointers & OOP Matthew Heaney
1999-05-01  0:00 ` Matthew Heaney
1999-05-03  0:00 ` John Robinson
1999-05-03  0:00   ` Samuel Mize
1999-05-04  0:00     ` Robert Dewar
1999-05-04  0:00     ` Martin C. Carlisle
1999-05-04  0:00   ` Robert Dewar
1999-05-04  0:00     ` Mike Silva
1999-05-05  0:00     ` John Robinson
1999-05-05  0:00       ` Robert Dewar
1999-05-05  0:00         ` John Robinson
1999-05-06  0:00           ` Brian Rogoff
1999-05-07  0:00             ` dennison
1999-05-07  0:00               ` Brian Rogoff
1999-05-10  0:00                 ` dennison
1999-05-11  0:00                   ` Jean-Pierre Rosen
1999-05-11  0:00                     ` dennison
1999-05-10  0:00             ` John Robinson
1999-05-14  0:00               ` Matthew Heaney
1999-05-14  0:00                 ` David Botton
1999-05-14  0:00           ` Matthew Heaney
1999-05-14  0:00             ` Ed Falis
1999-05-05  0:00       ` Matthew Heaney
1999-05-05  0:00       ` Robert Dewar
1999-05-08  0:00         ` Ehud Lamm
1999-05-06  0:00       ` Simon Wright
1999-05-06  0:00         ` John Robinson
1999-05-08  0:00           ` Simon Wright
1999-05-10  0:00             ` John Robinson
1999-05-06  0:00       ` Tom Moran
1999-05-06  0:00         ` John Robinson
1999-05-06  0:00           ` Tom Moran
1999-05-07  0:00             ` dennison
1999-05-07  0:00             ` dennison
1999-05-07  0:00             ` dennison
1999-05-10  0:00             ` John Robinson
1999-05-14  0:00         ` Matthew Heaney
1999-05-05  0:00     ` Francois Godme
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox