From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Protected type defined in the procedure
Date: Wed, 28 Sep 2005 10:10:33 +0200
Date: 2005-09-28T10:10:33+02:00 [thread overview]
Message-ID: <dhdj5p$o6r$1@sunnews.cern.ch> (raw)
Hi,
While learning Ada I have found the following problem.
It is possible to define a task within some procedure, like here:
procedure Hello is
task SomeTask is
-- ... some entries
end SomeTask;
task body SomeTask is
begin
-- ... (2)
end SomeTask;
begin
-- ... (1)
end Hello;
At some point I decided to use a protected object to act as a shared
data between (1) and (2). I was unable to find any way to define
appropriate protected type within the Hello procedure. Separate package
helped with this, but the question remains: is it at all possible to
define a protected type (*all* of it, including implementation of its
procedures, functions and entries) within the procedure where it is
supposed to be used? I find it to be reasonable, especially when
compared with the possibility of defining the whole task this way. In
fact, the protected object is not going to be used outside of the
Hello+SomeTask combo, so there is no need to pollute the project with
separate packages just for things like this.
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
next reply other threads:[~2005-09-28 8:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-28 8:10 Maciej Sobczak [this message]
2005-09-28 8:53 ` Protected type defined in the procedure Egil H. H�vik
2005-09-28 9:18 ` Martin Dowie
2005-09-28 9:35 ` Maciej Sobczak
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox