comp.lang.ada
 help / color / mirror / Atom feed
From: Ryan Tarpine <rtarpine@hotmail.com>
Subject: Re: Hiding a type
Date: Sat, 06 Jul 2002 20:38:42 +0000
Date: 2002-07-06T20:38:42+00:00	[thread overview]
Message-ID: <3D275552.4090903@hotmail.com> (raw)
In-Reply-To: ag7sbn$db9$1@bob.news.rcn.net

Frank J. Lhota wrote:
> My recommendation would be to skip the definition of Private_Type_Ptr
> entirely, and define Public_Name as the access type:
> 
> ...

The idea is that if I have 3 kinds of nodes (N1, N2, N3) with respective 
access types, I can rename one to be the public type (Root).  All 
private functions will take N1_Ptrs, N2_Ptrs, etc.  Only the public 
functions should take a Root.  Maybe N1_Ptr is at first the root type 
but later on another node type N4 is added and now N4_Ptr should be the 
root type.  I want to make sure that all the private functions don't 
have to change; if I had skipped the definition of N1_Ptr and just used 
Root, then my private functions would have to be changed since they 
should not take a Root but instead a pointer to an N1.  They should 
always take the same type regardless of what the root type is.  Whew!  I 
hope that doesn't sound as bad to you as it does to me :)

I did just come up with a small hack, though.  I can define the root to 
be the access type and then *subtype the root type* to make the private 
type.  If the root type changes, I can then modify the private type to 
directly be an access to the original node type.  I'm writing too much 
to explain myself; that means I must be doing something wrong :) It's 
kind of ugly, but it works.

Cheers,
Ryan




  reply	other threads:[~2002-07-06 20:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-06 17:17 Hiding a type Ryan Tarpine
2002-07-06 21:30 ` Pat Rogers
2002-07-06 18:16   ` Ryan Tarpine
2002-07-06 22:49     ` sk
2002-07-06 22:52     ` Frank J. Lhota
2002-07-06 20:38       ` Ryan Tarpine [this message]
2002-07-07 10:31         ` Frank J. Lhota
2002-07-07 11:20       ` Simon Wright
2002-07-07 13:58         ` Frank J. Lhota
2002-07-07 22:24           ` Ryan Tarpine
2002-07-07 17:15         ` Jeffrey Carter
2002-07-07 17:58           ` Simon Wright
2002-07-06 23:10     ` chris.danx
2002-07-06 20:21       ` Ryan Tarpine
2002-07-07  1:58         ` Jeffrey Carter
2002-07-08  7:20         ` Preben Randhol
2002-07-06 23:12       ` chris.danx
replies disabled

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