comp.lang.ada
 help / color / mirror / Atom feed
* Context syntax proposals, using "with", withing "use" etc.
@ 2003-12-22 23:53 Alexandre E. Kopilovitch
  2003-12-23 10:37 ` Martin Krischik
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre E. Kopilovitch @ 2003-12-22 23:53 UTC (permalink / raw)
  To: comp.lang.ada

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-12-23 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <PnfFuv_SxF@VB1162.spb.edu>
2003-12-23  9:02 ` Context syntax proposals, using "with", withing "use" etc Stephen Leake
2003-12-22 23:53 Alexandre E. Kopilovitch
2003-12-23 10:37 ` Martin Krischik

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