comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Any easy/build-in construct to extract submatrices from larger matrix?
Date: Tue, 26 Jun 2012 17:14:42 -0400
Date: 2012-06-26T17:14:42-04:00	[thread overview]
Message-ID: <wcc8vf9ydvh.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 5d23a78c-4bf2-4d07-8bca-8fac2064d5af@googlegroups.com

Adam Beneschan <adam@irvine.com> writes:

> In Ada 83, those three characters could be replaced by %, !, :
> respectively.  (It's still in the language as a deprecated feature;
> see J.2.)
>
> I don't think it would have worked to say that [] is used for array
> indexing, but that they could be replaced by () if the symbols []
> weren't available.  The reason was is that changing [] to () would
> introduce some ambiguities where none existed before, which I think
> would really screw up the overload resolution rules.  (Suppose you
> have two functions F, one that takes an integer parameter and returns
> an integer, and one that takes no parameters and returns a array of
> integer or an access to an array of integer.  Now, if [] were used as
> the array index, with no replacement allowed?  F(3) would
> unambiguously call the F that takes a parameter and F[3] would
> unambiguously call the parameterless F that returns an array or
> access-array.  But what if the rules said that [ and ] could be
> relaced by ( and )?  What would the rules say about F(3) now?

You could make that work.  The rules would say that F(3) and F[3]
are ambiguous, given the two F's you mention above.  Then a legality
rule would say you have to use [] for arrays.

But that's not what I was thinking of.

>...I think
> this would be too confusing.)

Agreed.  And it doesn't really accomplish the goal, because
when you see A(I) you don't know if it's a call or an array indexing.
Apparently, Ichbiah et al didn't share that goal anyway -- they
thought it's a feature to confuse calls and array indexing.
I have mixed feelings about it.  On the one hand, a constant
array is just like a function without side effects.  But on the
other hand, when you consider that you can do "A(I) := ..."
for arrays, and function calls can go around modifying global
variables, the two features don't look very similar.
All in all, I'm in favor of two different notations.

>...Another possibility would be to say
> that [ and ] could be replaced by two-character sequences such as, for
> instance, (: and :) This would be unambiguous because smileys hadn't
> yet been invented.

Yeah, THAT's what I was thinking of.  Or (. and .) .

>...I think that would have worked but I guess nobody
> thought of that.

Well, they should have.  After all, they came up with essentially
the same idea for " | #.  And they supposedly started their
design based on Pascal, which uses the same idea -- comments
are surrounded by {...}, but you're allowed to use (*...*)
instead.  This isn't rocket science!  ;-)

Using the same syntax for arrays and functions doesn't bother
me THAT much, but it really rubs me the wrong way that you
can't have zero- and one-component positional aggregates.
Using [...] for aggregates would solve that, without
ambiguity.  And blaming that large language design flaw
on character set / keyboard issues doesn't hold water.

The steelman requirement that somebody quoted was:

    "Every source program shall also have a representation that
    uses only the following 55 character subset of the ASCII graphics:

Note "also have", which can be accomplished by these optional
replacements.

By they way, they didn't actually meet that requirement.
Can you think of an Ada 83 program that cannot be represented
in those 55 characters?  ;-)

- Bob



  reply	other threads:[~2012-06-26 21:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-24  8:05 Any easy/build-in construct to extract submatrices from larger matrix? Nasser M. Abbasi
2012-06-24  8:24 ` Dmitry A. Kazakov
2012-06-24  8:55   ` Nasser M. Abbasi
2012-06-24 11:10     ` Dmitry A. Kazakov
2012-06-24 12:16       ` Nasser M. Abbasi
2012-06-24 16:11         ` Dmitry A. Kazakov
2012-06-24 17:14           ` Nasser M. Abbasi
2012-06-24 18:33             ` Dmitry A. Kazakov
2012-06-25  5:44             ` J-P. Rosen
2012-06-25  6:32               ` Nasser M. Abbasi
2012-06-25  7:54                 ` J-P. Rosen
2012-06-25  8:20                   ` Dmitry A. Kazakov
2012-06-25 14:21                   ` Nasser M. Abbasi
2012-06-25  8:36                 ` Georg Bauhaus
2012-06-25 13:17                   ` Nasser M. Abbasi
2012-06-26 11:44                     ` Georg Bauhaus
2012-06-25 16:49                 ` Pascal Obry
2012-06-25 17:36                   ` Nasser M. Abbasi
2012-06-25 18:49                     ` stefan-lucks
2012-06-26  4:41                       ` Nasser M. Abbasi
2012-06-26  7:15                 ` Jacob Sparre Andersen
2012-06-26  9:51                   ` Nasser M. Abbasi
2012-06-25  9:33               ` Simon Wright
2012-06-26  2:48 ` Jerry
2012-06-26  4:19   ` Nasser M. Abbasi
2012-06-26  7:06   ` Nasser M. Abbasi
2012-06-26 12:54     ` Robert A Duff
2012-06-26 15:19       ` Adam Beneschan
2012-06-26 21:14         ` Robert A Duff [this message]
2012-06-27 23:42     ` Shark8
2012-06-26  7:10   ` Dmitry A. Kazakov
2012-06-26 15:06   ` Adam Beneschan
2012-06-26 21:19     ` Robert A Duff
2012-06-26 21:40       ` Adam Beneschan
2012-07-03  4:22         ` Randy Brukardt
2012-07-03  8:37           ` Dmitry A. Kazakov
2012-07-05  1:33             ` Randy Brukardt
2012-07-05  7:08               ` Dmitry A. Kazakov
2012-07-06 23:47                 ` Randy Brukardt
2012-07-07  8:22                   ` Dmitry A. Kazakov
2012-07-05 18:56               ` Adam Beneschan
replies disabled

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