comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Workqueues in Ada
Date: Sat, 28 Jul 2007 20:30:49 -0400
Date: 2007-07-28T20:30:49-04:00	[thread overview]
Message-ID: <wcclkd03vba.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: f8gevq$rb6$1@atlantis.news.tpi.pl

Wiktor Moskwa <wiktorDOTmoskwa@gmail.com> writes:

> In PragmARC most packages get a limited private generic type (called
> Element) as an argument. Above error arises in components' Get functions 
> that return Element.

I presume they are intended to return a COPY of the element,
so "limited" doesn't seem appropriate on the formal type.

>> Right, this is illegal in Ada 2005.  The fix is probably to remove
>> "limited" from Element, above, but I'd have to see the actual code to be
>> sure.  The compiler suggests, "consider switching to return of access
>> type", but I think that's bogus.
>
> It doesn't look easy to port such code to Ada 2005 without removing 
> "limited".

Agreed.

 It would probably mean switching whole library to use a lot 
> of access types instead of "implicit passing by reference" which is now.

Well, it's just function returns that would have to change,
but that would probably be an earthquake.


> Nice to hear :) Limited types idea seems quite difficult to me.

A limited type is a type where it doesn't make sense to copy objects.

>...I don't
> understand why limited "in" arguments can be passed by reference to a 
> procedure but "out" can't

All limited parameters are passed (implicitly) by reference.
Same for all tagged types.  This applies to "in", "out"
and "in out".

The interesting case (new to Ada 2005) is function returns,
which are "build in place" for limited types (except for
limited types whose full type is nonlimited).

>... (probably because after passing object to
> the caller that object can finish its life but it's still fuzzy).
> I had lots of problems with tagged types too. I wonder if using 
> access parameters everywhere is a remedy for all troubles in Ada 2005.

No, I think it's better not to use access types "everywhere".

- Bob



  reply	other threads:[~2007-07-29  0:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-28 17:00 Workqueues in Ada Wiktor Moskwa
2007-07-28 17:28 ` Dmitry A. Kazakov
2007-07-28 17:52   ` Wiktor Moskwa
2007-07-28 19:53     ` Simon Wright
2007-07-28 21:25       ` Wiktor Moskwa
2007-07-28 20:45     ` Dmitry A. Kazakov
2007-07-28 21:19       ` Wiktor Moskwa
2007-07-29  8:36         ` Dmitry A. Kazakov
2007-07-29 19:53           ` Wiktor Moskwa
2007-07-30  6:47             ` Niklas Holsti
2007-07-30 15:56               ` Matthew Heaney
2007-07-30 15:53             ` Matthew Heaney
2007-07-30 19:57               ` Wiktor Moskwa
2007-07-30 15:52           ` Matthew Heaney
2007-07-31 20:54             ` Wiktor Moskwa
2007-08-01  8:30               ` Dmitry A. Kazakov
2007-07-28 17:31 ` Jeffrey R. Carter
2007-07-28 17:56   ` Wiktor Moskwa
2007-07-28 20:18   ` Wiktor Moskwa
2007-07-28 20:48     ` Robert A Duff
2007-07-28 21:03       ` Wiktor Moskwa
2007-07-28 21:38         ` Robert A Duff
2007-07-28 22:12           ` Wiktor Moskwa
2007-07-29  0:30             ` Robert A Duff [this message]
2007-07-29  6:38               ` Jeffrey R. Carter
2007-07-29  6:34           ` Jeffrey R. Carter
2007-07-29  6:30     ` Jeffrey R. Carter
2007-07-28 21:54 ` Robert A Duff
2007-07-30 15:48 ` Matthew Heaney
replies disabled

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