comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: [OT] interesting reason why a language is considered good
Date: Tue, 17 Apr 2012 09:46:38 +0200
Date: 2012-04-17T09:46:39+02:00	[thread overview]
Message-ID: <4f8d1fdf$0$6638$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <jmiotp$3gc$1@munin.nbi.dk>

On 17.04.12 05:43, Randy Brukardt wrote:
>  Ada requires the names of the parameters to be
> those used in *calls*.

Yes. In case there is a callable.

> ...  The solution is to define the
> parameter names as needed for readability in calls, and then (if those names
> are problematic in the body), rename them for use in the body:
>
>       Exit_Time : Time renames When;
>
> ...
>> begin
>>     while Now<  Scheduled_Departure loop
>>        delay Pausing_Time;
>>        Now := Clock;
>>     end loop;
>>     Actual_Departure (Minute_Of (Scheduled_Departure)) := Now;
>> end Leave;
>
> Unfortunately, this solution makes insanely wordy calls:
>
>      Leave (Scheduled_Departure =>  Now);
>
> In many cases, the parameter names overwhelm the actual values.

So, if Exit_Time is what you'd choose to denote the kind of time
you have in mind, what about

   Leave (Exit_Time => Now) ?

To me, "Exit_Time" says a lot more than "when" in any case!
Why this insistence on "when"?

There is an curious phenomenon here: everyone seems to be
concentrating on parameter names. A case in which there is
context. So there is

- a unanimous vote in case of parameters: "when" is great!
- a workaround for some other cases (but not aggregates, ...)
- thoughtful considerations

Still no answer to the question about a fraction of programs
profiting from identifiers "when" and "others", so much that
they should be allowed. I'd challenge, if I may, the compiler
writers:  Would you compiler writers honestly prefer to write
code like

   for some access in record =>
      when(access) = array(of);

   when when > at =>
   accept record (type) do
      task.type := type;
   done;

Trying to understand the source text requires constantly
switching levels of meanings of the words. Does it really
help?

Nevertheless, I'd add expression functions to the set of
solutions, which now only includes (re)naming of objects.
A kind of the LET expressions:

   function Outer (par1, par2: T) return T is

      function flap return T is
          (par1 + globalN);

      function fluff return T is
          (((par2 + par1)) / 2 * flap);

   begin
      return flap * fluff;
   end Outer





  parent reply	other threads:[~2012-04-17  7:46 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi
2012-04-15 11:57 ` J-P. Rosen
2012-04-16 10:37   ` Peter C. Chapin
2012-04-15 12:27 ` Dmitry A. Kazakov
2012-04-17  6:59   ` tonyg
2012-04-17  7:43     ` Dmitry A. Kazakov
2012-04-15 14:05 ` Bill Findlay
2012-04-15 14:21 ` Pascal Obry
2012-04-15 14:54   ` Simon Wright
2012-04-15 15:34     ` Pascal Obry
2012-04-17  5:42       ` Brad Moore
2012-04-17 16:11         ` Simon Wright
2012-04-17 16:33           ` Robert A Duff
2012-04-17 19:34             ` Simon Wright
2012-04-17 21:42               ` Robert A Duff
2012-04-17 22:24                 ` Randy Brukardt
2012-04-18  7:00                   ` stefan-lucks
2012-04-17 21:17             ` Jeffrey Carter
2012-04-15 23:53     ` Brian Drummond
2012-04-16 10:43 ` Marius Amado-Alves
2012-04-16 11:48   ` Georg Bauhaus
2012-04-16 13:06     ` Dmitry A. Kazakov
2012-04-16 15:01       ` Georg Bauhaus
2012-04-16 15:31         ` Dmitry A. Kazakov
2012-04-16 17:11           ` Georg Bauhaus
2012-04-16 17:19             ` Georg Bauhaus
2012-04-16 18:00             ` Dmitry A. Kazakov
2012-04-16 21:48               ` Georg Bauhaus
2012-04-17  3:43                 ` Randy Brukardt
2012-04-17  4:43                   ` Bill Findlay
2012-04-17  7:46                   ` Georg Bauhaus [this message]
2012-04-17 22:32                     ` Randy Brukardt
2012-04-18  7:10                       ` stefan-lucks
2012-04-18 23:48                         ` Randy Brukardt
2012-04-19 14:22                           ` Shark8
2012-04-17 15:48                   ` Simon Wright
2012-04-17 16:15                     ` Dmitry A. Kazakov
2012-04-17 19:33                       ` Simon Wright
2012-04-17  7:34                 ` Dmitry A. Kazakov
2012-04-17 16:01                   ` Simon Wright
2012-04-17 17:42                   ` Georg Bauhaus
2012-04-17 19:17                     ` Dmitry A. Kazakov
2012-04-17  3:24           ` Randy Brukardt
2012-04-17  3:33           ` Randy Brukardt
2012-04-16 19:55   ` sbelmont700
2012-04-17  0:48   ` Peter C. Chapin
2012-04-17 21:59 ` anon
2012-05-13  4:14   ` David Thompson
replies disabled

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