comp.lang.ada
 help / color / mirror / Atom feed
From: alex@MIMSY.CS.UMD.EDU  (Alex Blakemore)
Subject: Re: User-defined assignment
Date: 30 Oct 92 02:39:10 GMT	[thread overview]
Message-ID: <61612@mimsy.umd.edu> (raw)

In article <11237@platypus.uofs.uofs.edu> beidler@guinness.cs.uofs.edu (Jack Be
idler) writes:
> I wonder if Booch had to do it all over again if he would have used
> limited private types. [for generic formal types ?]

  I sure hope so, exporting limited but importing non limited types makes
composing abstractions close to impossible. if anything, that strategy is
completely backwards.

> By requiring that limited private types be supplied with the correct resource
s
> the client is not longer hindered by a lack of ":=" .

absolutely.  whenever you see

  generic
    type xxx is private;

instead of 

  generic
    type xxx is limited private;
    function "=" (left, right : xxx) return boolean is <>; -- only if needed
    procedure assign (left in out xxx; right : xxx);       -- ditto

little warning signs should go off. The first form makes predefined equality
and assignnment visible & its impossible to tell from the generic spec
whether they are used (i.e. the assumptions remain unstated).
It is also impossible to instantiate the generic using any other
form of equality and assignment.  This means you cant instantiate it
with a limited private type - and an access type wont work (as Booch suggests)
because you end up testing whether the pointers are the same instead
of the objects.

In spite of any irritation you may have had with limited private
types, it really helps to make generic formal types limited instead of
private.  This causes the generic writer to type a little more but
makes the generic package more general.

This is entirely different from the decision as to whether to make
exported types limited - in that case judgement is required.
I cant think of a single good reason to ever
import a private type instead of a limited private type.
-- 
---------------------------------------------------
Alex Blakemore alex@cs.umd.edu   NeXT mail accepted

             reply	other threads:[~1992-10-30  2:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-10-30  2:39 Alex Blakemore [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-10-29 18:20 User-defined assignment Jack Beidler
1992-10-22 22:19 dog.ee.lbl.gov!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!darwin.su
1992-10-21 23:42 dog.ee.lbl.gov!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!rpi!bu.ed
1992-10-20 15:12 Rick Hudson
1992-10-19 14:13 Douglas N. Surber
1992-10-19  7:55 Dag Bruck
1992-10-19  7:31 Dag Bruck
1992-10-18 19:29 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!uvaarpa!soft
1992-10-17 23:32 Tucker Taft
1992-10-17 17:57 dog.ee.lbl.gov!hellgate.utah.edu!caen!malgudi.oar.net!zaphod.mps.ohio-sta
1992-10-16 23:13 dog.ee.lbl.gov!hellgate.utah.edu!cs.utexas.edu!qt.cs.utexas.edu!news.Brow
1992-10-16 11:58 St ef Van Vlierberghe
1988-12-09 13:16 user-defined assignment Robert Firth
1988-12-09 20:35 ` David S. Rosenblum
replies disabled

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