comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Re-exporting primitive operations of a private type (like "-", and 'min)
Date: Mon, 31 Oct 2005 10:18:23 +0100
Date: 2005-10-31T10:18:24+01:00	[thread overview]
Message-ID: <15npz1rdb1za2.ge81hrlz9pyk$.dlg@40tude.net> (raw)
In-Reply-To: ZDk9f.7943$M16.3294@reader1.news.jippii.net

On Mon, 31 Oct 2005 10:27:51 +0200, Niklas Holsti wrote:

> Anonymous Coward wrote:
>>>The whole point of private types is that the only visible operations
>>>on them are assignment, equality and inequality, and any explicitly
>>>defined operations in the visible part of the package
>>>specification. 
>> 
>> That makes sense.  As a default, it probably would be a poor language
>> design to have private types automatically export public primitive
>> operations.  If I created an Altitude_Type, I wouldn't want to inherit
>> the "+" operation.
> 
> The following is perhaps not quite on the original topic, but this 
> thread reminds me of an idea for a new feature related to private 
> types that I would like to present.
> 
> My Ada packages often define types that are *mostly* private in 
> the sense that I only want the clients to use a restricted set of 
> operations and properties of the type. However, I often do not 
> make these types actual private types because I want to reveal 
> some properties, such as discreteness, that I cannot now specify 
> for a private type.
> 
> I would like to be able to reveal some properties of private types 
> in the same way as we can now define generic formal types, for 
> example saying that the type is discrete (type T is (<>)) or is a 
> modular type (type T is mod <>).

[...]

> Does this idea appeal to anyone?

That would a repetition of the error made with generics. Instead of

   type Element is private (<>);

it should be just

   type Element is new Abstract_Integer with private;

which would solve everything.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-10-31  9:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-29 21:19 Re-exporting primitive operations of a private type (like "-", and 'min) Anonymous Coward
2005-10-30  8:57 ` Dmitry A. Kazakov
2005-10-30  9:18 ` Jeffrey R. Carter
2005-10-30 14:16   ` Martin Krischik
2005-10-30 22:35     ` Robert A Duff
2005-10-31  4:15   ` Anonymous Coward
2005-10-31  4:34     ` Anonymous Coward
2005-10-31  6:14     ` Jeffrey R. Carter
2005-11-01  3:39       ` Anonymous Coward
2005-11-01  4:47         ` Jeffrey R. Carter
2005-11-01 23:43           ` Anonymous Coward
2005-11-02  3:35             ` Jeffrey R. Carter
2005-11-01 14:11         ` Robert A Duff
2005-10-31  8:27     ` Niklas Holsti
2005-10-31  9:18       ` Dmitry A. Kazakov [this message]
2005-11-02  9:50       ` Jean-Pierre Rosen
2005-11-03  9:15         ` Niklas Holsti
replies disabled

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