comp.lang.ada
 help / color / mirror / Atom feed
* smart pointer dangerous (no -> operator)
@ 2009-01-16 10:04 Oliver Kowalke
  2009-01-16 11:09 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Oliver Kowalke @ 2009-01-16 10:04 UTC (permalink / raw)


Hello,
Ada doesn't support the dereference operator -> as C++.

So Ada provides only two ways to access the managed object?

- returning it via value : function Get(Pointer : Smart_Pointer) return
Object;

- returning it via access type : function Get(Pointer : Smart_Pointer)
return Access_Object;

- returning a proxy which implements the functions applicable to the managed
object

In the first case I can not manipulate the state of the managed object
(setting some internal data).
The second case is dangerous because the ownership 'constraint' can be
violated -> other code can call Unchecked_Delete on the returned access
type or assign it to another one.

How can case three be implemented in Ada if the smart ponter package is
generic?


regards,
Oliver



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-01-18 12:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-16 10:04 smart pointer dangerous (no -> operator) Oliver Kowalke
2009-01-16 11:09 ` Dmitry A. Kazakov
2009-01-16 11:42   ` Georg Bauhaus
2009-01-16 12:43     ` Dmitry A. Kazakov
2009-01-16 21:21     ` Maciej Sobczak
2009-01-17 19:07       ` Georg Bauhaus
2009-01-16 11:46   ` Oliver Kowalke
2009-01-16 12:45     ` Dmitry A. Kazakov
2009-01-17  0:43   ` Brian Drummond
2009-01-17  9:28     ` Dmitry A. Kazakov
2009-01-16 20:08 ` Tero Koskinen
2009-01-16 21:16   ` Maciej Sobczak
2009-01-18 12:21 ` Samuel Tardieu

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