Re: entry_barrier, entry_body & entry_declaration
- From: "Randy Brukardt" <randy@xxxxxxxxxxxxxx>
- Date: Thu, 19 Jan 2006 16:35:59 -0600
<ada_student@xxxxxxxxx> wrote in message
news:1137694936.037209.266520@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
....
> However, what the designers clearly overlooked is that they need
> to allow the programmer to differentiate in the spec between an
> entry with a barrier and one without[since we have stated in
> the previous paragraph that part of the barrier belongs in
> the spec].
Not at all. The interesting property to the client is whether or not the
call can block. And that is *clearly* describable in the syntax: either it
can block (use a protected entry) or it can't block (use a protected
procedure).
Also, remember that there are other ways for a protected entry to block:
specifically requeue. Many of my protected objects have entries with a True
barrier; it's the entry body that decides whether or not the call needs to
wait, and then requeues it if it does. Just putting the barrier into the
spec. would only show part of the equation.
Similarly, task entries can block even without a barrier, simply because the
task may not be executing an appropriate accept statement at the time the
entry is called. So all task entries can block, and there is nothing
interesting about that.
To give more information than just block/no block, Ada would need a formal
precondition notation, which would be in the specification. But Ada doesn't
have this for any sort of call, so their lack for entries is hardly unusual
or surprising. Indeed, few programming languages have any serious support
for preconditions (Eiffel is one exception). We looked at remedying this in
Ada 200Y, but the features to do so turned into complex runtime checks --
and that is the opposite direction as most systems are going (more
compile-time checks) -- and thus it wasn't clear that the features were a
real (as opposed to preceived) benefit to the language and community.
So, you have to describe in the comments for the entry the intended use, and
obviously such comments can't be formally checked. But the description of
functions, procedures, and entries is an important part of the specification
of an Ada callable entity -- the language can only go so far.
Randy.
.
- References:
- entry_barrier, entry_body & entry_declaration
- From: ada_student
- Re: entry_barrier, entry_body & entry_declaration
- From: Georg Bauhaus
- Re: entry_barrier, entry_body & entry_declaration
- From: ada_student
- entry_barrier, entry_body & entry_declaration
- Prev by Date: Re: entry_barrier, entry_body & entry_declaration
- Next by Date: Re: entry_barrier, entry_body & entry_declaration
- Previous by thread: Re: entry_barrier, entry_body & entry_declaration
- Next by thread: Re: entry_barrier, entry_body & entry_declaration
- Index(es):
Relevant Pages
|