comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Re[2]: Limited Type Access - Again
Date: Mon, 29 Oct 2001 18:02:10 -0500
Date: 2001-10-29T18:02:10-05:00	[thread overview]
Message-ID: <ttrnpujllvpb60@corp.supernews.com> (raw)
In-Reply-To: mailman.1004394165.6249.comp.lang.ada@ada.eu.org


<ANH_VO@udlp.com> wrote in message
news:mailman.1004394165.6249.comp.lang.ada@ada.eu.org...
> If equality and assignment are allowed in this case, then it is the back
door
> for comparing and assigning objects of limited type such as task type and
> projected type.

No.  A record type is limited if it has limited components:

task type T;

type RT is
   record
      O : T;
   end record;

O1, O2 : RT;

O1 := O2;  --will NOT compile

if O1 = O2 then --will NOT compile



> I think this door should be locked.

Already done.  This was true already in Ada83.


> In addition, comparing or
> assignment two objects of a task type does not make sense.

It's up to you to decide whether task comparison makes sense.  Note that in
Ada95 you can compare Task_Id's.


>  In fact, the language
> prohibits two objects of a limited type from being compared or assigned.
This is
> the reason why equality and assignment of a limited type are prohibited.

Not quite -- you don't ever have assignment, but you don't have equality *by
default*.  Meaning you can provide your own equality operator for a limited
type:

type RT is
   limited record ... end record;

function "=" (L, R : RT) return Boolean is ...

Or even:

task type TT;

function "=" (L, R: TT) return Boolean is...







  reply	other threads:[~2001-10-29 23:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-29 20:14 Re[2]: Limited Type Access - Again ANH_VO
2001-10-29 23:02 ` Matthew Heaney [this message]
2001-10-30  7:07 ` Sergey Koshcheyev
2001-10-30 17:10 ` Mark Lundquist
replies disabled

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