comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Why was it done this way ?
Date: 27 Oct 2005 11:07:14 -0400
Date: 2005-10-27T11:07:14-04:00	[thread overview]
Message-ID: <wccslunc82l.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 43609fe2$0$22537$9b4e6d93@newsread4.arcor-online.net

Georg Bauhaus <bauhaus@futureapps.de> writes:

> I think it might be difficult in general to detect mutual
> recursion, but IANALL ...

It is a language design principle that the compiler should be able to
detect legality errors by looking only at the current compilation unit,
and things it depends upon semantically.  In particular, the compiler
shouldn't have to look at other package bodies.  The mutually recursive
tasks could be separately compiled.  There are a few exceptions to
this principle (see "Post-Compilation Rules" in the RM).  These are
deliberately kept to a minimum.

As JPR pointed out, the goal of the rule (that the task type name
denotes the task when inside it) is _not_ to prevent recursion.
It is simply a convenient way to refer to the current instance.
The same rule applies to records and generic units.  The language
could have been designed to have special syntax for this case
(something like "this T1").

Anyway, recursion (mutual or otherwise) of tasks is useful (in rare cases),
so it would be annoying if it were forbidden.  It might be nice
to detect _infinite_ recursion of tasks (or of procedures, for
that matter), but that's impossible in the general case.

I believe GNAT is capable of printing a warning on _some_ infinite
recursions (of procedures).

- Bob



      reply	other threads:[~2005-10-27 15:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-27  1:00 Why was it done this way ? Heimlich Manure
2005-10-27  2:30 ` jimmaureenrogers
2005-10-27  2:39   ` Heimlich Manure
2005-10-27  6:09     ` Jeffrey R. Carter
2005-10-27  6:46     ` Jean-Pierre Rosen
2005-10-27  2:46 ` Steve
2005-10-27  9:39 ` Georg Bauhaus
2005-10-27 15:07   ` Robert A Duff [this message]
replies disabled

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