From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Subscript brackets
Date: 1996/05/01
Date: 1996-05-01T00:00:00+00:00 [thread overview]
Message-ID: <EACHUS.96May1170359@spectre.mitre.org> (raw)
In-Reply-To: 4m515d$pok@calypso.bns.com.au
In article <4m515d$pok@calypso.bns.com.au> mike@calypso.bns.com.au (Michael Talbot-Wilson) writes:
> Are there any plans to convert from parentheses to square brackets
> for array subscripts in Ada?
Not in this millenium....
> Maybe this is a minor point, and I guess BASIC, PL/I and FORTRAN
> programmers think it's better as it is. (And I guess the use of
> parentheses reflects that Ada's heritage is in those languages.)
No, it reflects a unification between tabular data and functions
which is totally intentional. I often prototype with many complex
options being tables in the prototype, and functions in the final
product:
type Message_Length is array (Message_Type) of Integer;
...
function Message_Length(M: in Message_Type) return Integer;
This allows the message lengths to be changed in a table without
recompiling things.
> But C, Pascal, Modula-2 and (if there are any left alive) ALGOL
> programmers feel the reverse. Minor or not, it is a big psycho-
> logical hurdle to adjust to something inferior (and even the FAQ
> concedes that this is a broken feature) in the name of doing
> things better.
> A preprocessor which converted just these parentheses to brackets
> and left non-array-subscript parentheses alone would allow
> existing source to be compiled. And (I guess) remove the ambiguities
> of parsing this feature from the compiler, allowing its cost to
> be more clearly seen.
I have a better idea...write a preprocessor to replace square
brackets with angle brackets, and you will have no problem using
existing Ada compilers. I could probably write a very good
preprocessor of this form in a couple hours.
However, if you decide to do realistic error checking, you have a
lot of decisions to make. Do all attributes use parentheses, or just
those which are functions? If A'First[1] requires brackets, what
about A'Range(1)? You get the picutre.
> It there any intention of doing this? Is there any suggested date
> when it might happen? I think some people who would like to convert
> to or start working in Ada would like a date to aim at, supposing it
> is ever going to happen.
I doubt it. It could be done, but it would be a rough haul for very
little gain.
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
next prev parent reply other threads:[~1996-05-01 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-30 0:00 Subscript brackets Michael Talbot-Wilson
1996-05-01 0:00 ` Robert I. Eachus [this message]
1996-05-02 0:00 ` Robert A Duff
1996-05-02 0:00 ` Robert Dewar
1996-05-02 0:00 ` Robert Dewar
1996-05-03 0:00 ` Tarjei Jensen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox