comp.lang.ada
 help / color / mirror / Atom feed
From: "Alexandre E. Kopilovitch" <aek@VB1162.spb.edu>
To: comp.lang.ada@ada-france.org
Subject: Context syntax proposals, using "with", withing "use" etc.
Date: Tue, 23 Dec 2003 02:53:13 +0300 (MSK)
Date: 2003-12-23T02:53:13+03:00	[thread overview]
Message-ID: <mailman.166.1072137205.31149.comp.lang.ada@ada-france.org> (raw)

After watching for some time the prolonged dances around "with and use",
I'm inclined to contribute to the topic.

First, I'd like to say that all the arguments concerned with repeating of a
package's name aren't serious at all: as for extra typing, this is a matter
of a text editor, not of the language; and as for a possibility of mistake
(that is, placing an unintended package's name in "use"), it is a matter of
a style and a corresponding style checker compiler option - you have little
chance to get such a mistake unnoticed with a quite simple rule: for example,
always place "use" and "with" in the same line, and never mix different
packages in the same line (compiler can easily verify that).

Second, there is still a displeasure here, which can even become a hindrance
in some circumsrances: when there are many context clauses for a package,
they just occupy too big part of the text; and because those context clauses
are necessarily at the beginning of each package, they intersperse and clutter
the whole program, which makes reading more difficult (even if each package
has its own window) - if one tried not to study thoroughly, but just to read
and catch the general method\logic\approach of the program.

So my guess is that the real reasons demanding the changes for "with" and
"use", if any, aren't about repeated package names, but actually about overall
amount of the text in (all) context clauses (and exclusion of repeated package
names simply decreases this amount).

Therefore I think that explicit separatation of the whole context from the
package's specs as well as from the package's body would be much more
consistent and useful step (than all possible manipulation with "with" and
"use" only) for the purpose. I mean something like that:

  package MyDream context is
  -- or package context MyDream is  - if you like it better
    with ...;
    with ...; use ...;
    ...
  end MyDream;

  package MyDream is
    ...
  end MyDream;

  package body MyDream context is
    with ...;
    with ...; use ...;
    ...
  end MyDream;

  package body MyDream is
    ...
  end MyDream;


Certainly there may be other syntactic forms for that separation, and extra
keyword ("context") may be avoided... although it seems in place there.



Alexander Kopilovitch                      aek@vib.usr.pu.ru
Saint-Petersburg
Russia




             reply	other threads:[~2003-12-22 23:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-22 23:53 Alexandre E. Kopilovitch [this message]
2003-12-23 10:37 ` Context syntax proposals, using "with", withing "use" etc Martin Krischik
     [not found] <PnfFuv_SxF@VB1162.spb.edu>
2003-12-23  9:02 ` Stephen Leake
replies disabled

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