comp.lang.ada
 help / color / mirror / Atom feed
From: "Samuel T. Harris" <samuel_t_harris@Raytheon.com>
Subject: Re: scripting/extension language for Ada (we have an opportunity here)
Date: 2000/02/16
Date: 2000-02-16T00:00:00+00:00	[thread overview]
Message-ID: <38AAF0C1.C3F82C40@Raytheon.com> (raw)
In-Reply-To: wccya8lc9xs.fsf@world.std.com

Robert A Duff wrote:
> 
> "Samuel T. Harris" <samuel_t_harris@Raytheon.com> writes:
> 
> > Certainly I can. Since [] and {} are not legal Ada tokens,
> > they many only appear in comments and string literals.
> > A syntax to handle these so that other [] and {}
> > are converted to () is trivial to do.
> 
> No, I don't think it's trivial to do it right.
> 
> Consider:
> 
> procedure Main is
>     function F return String is
>     begin
>         return "A";
>     end F;
> 
>     procedure Nested is
>         function F(X: Integer) return Character is
>         begin
>             return 'B';
>         end F;
>     begin
>         Text_IO.Put(F[1]); -- Not Ada.
>     end Nested;
> begin
>     Nested;
> end Main;
> 
> Presumably the F[1] above resolves to the outer F, which returns an
> array, so the program prints "A".  If you "trivially" transform "[...]"
> into "(...)" you will get an illegal (ambiguous) Ada program.
> 
> - Bob

In supporting [] for arrays and {} for aggregates, I did
not mean to imply changing any Ada semantics. They simply
make the recognizer grammar much simpler since ()
isn't used for so many things. Indeed, I have said previously
that I want as much Ada semantics as is reasonbly feasible.

If F(1) is ambiguous in Ada, then so should F[1] be ambiguous
in the scripting language. Using [] for arrays is a syntactic
short-cut enabling a much simpler grammar. Semantics don't
have to be similarly "simplistic". Indeed, I'd expect the
script interpreter to say something more than just
that I have an ambiguous reference. I'd expect to say
something like I have an ambiguous reference between
an intended array subscript and an homogenenous function
call.

I failed to mention before that I feel the substitution
of [] and {} would be akin to using % instead of ",
: instead of #, and ! instead of | except that instead
of being optional, [] and {} are mandatory. In this way, 
the syntax of array index does not have to be boggled 
with named notation since the explicit delimiters [] do not
allow named notation. So I don't need syntax non-terminals
such as function_call_or_array_index_or_qualified_aggregate
with all the complexity involved. The semantics
still have to verify the appropriate nature of
the element.

Given this, I believe you would agree that the substitution
of () for [] and {} would now be trivial. Problem cases
such as the one you cite above should not allowed by the
semantics of the Ada interpreter. Otherwise, I see no
benefit to using these special substitutions except
to satisfy the expectations of prior experience with
other languages.

-- 
Samuel T. Harris, Principal Engineer
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"




  reply	other threads:[~2000-02-16  0:00 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-27  0:00 tagged types extensions - language design question Vladimir Olensky
2000-01-27  0:00 ` Laurent Guerby
2000-01-28  0:00   ` Vladimir Olensky
2000-01-28  0:00     ` Andy
2000-01-28  0:00       ` Vladimir Olensky
2000-01-29  0:00         ` Andy
2000-01-31  0:00           ` Vladimir Olensky
2000-01-27  0:00 ` Matthew Heaney
2000-01-27  0:00   ` Charles Hixson
2000-01-28  0:00   ` Vladimir Olensky
2000-01-28  0:00     ` Matthew Heaney
2000-01-28  0:00       ` Charles Hixson
2000-01-28  0:00         ` Matthew Heaney
2000-02-01  0:00           ` Charles Hixson
2000-02-01  0:00             ` Matthew Heaney
2000-01-29  0:00       ` Vladimir Olensky
2000-01-29  0:00         ` Matthew Heaney
2000-01-31  0:00           ` Vladimir Olensky
2000-01-31  0:00             ` Matthew Heaney
2000-01-31  0:00               ` Vladimir Olensky
2000-01-29  0:00         ` Matthew Heaney
2000-01-27  0:00 ` Fraser
2000-01-28  0:00 ` Tucker Taft
2000-01-31  0:00   ` Vladimir Olensky
2000-02-01  0:00   ` Charles Hixson
2000-02-01  0:00     ` Matthew Heaney
2000-02-01  0:00       ` Brian Rogoff
2000-02-03  0:00         ` scripting/extension language for Ada (was : Re: tagged types extensions) root
2000-02-03  0:00           ` Brian Rogoff
2000-02-04  0:00             ` Ray Blaak
2000-02-04  0:00               ` Robert A Duff
2000-02-05  0:00                 ` blaak
2000-02-05  0:00                   ` Brian Rogoff
2000-02-09  0:00                   ` Robert A Duff
2000-02-09  0:00                     ` Ted Dennison
2000-02-10  0:00                       ` Samuel T. Harris
2000-02-05  0:00                 ` Ehud Lamm
2000-02-10  0:00                 ` Pascal Martin
2000-02-10  0:00                   ` Ray Blaak
2000-02-11  0:00                     ` David Starner
2000-02-12  0:00                       ` blaak
2000-02-15  0:00                         ` Brian Rogoff
2000-02-12  0:00                       ` Pascal Martin
2000-02-11  0:00                     ` scripting/extension language for Ada (we have an opportunity here) Tarjei T. Jensen
2000-02-11  0:00                       ` Robert I. Eachus
2000-02-12  0:00                         ` Pascal Martin
2000-02-13  0:00                           ` Robert I. Eachus
2000-02-16  0:00                             ` scripting/extension ... [off topic] Nick Roberts
2000-02-16  0:00                               ` Ray Blaak
2000-02-12  0:00                         ` scripting/extension language for Ada (we have an opportunity here) Tarjei Tj�stheim Jensen
2000-02-12  0:00                           ` root
2000-02-12  0:00                           ` Samuel T. Harris
2000-02-14  0:00                             ` Robert A Duff
2000-02-15  0:00                               ` Samuel T. Harris
2000-02-16  0:00                                 ` Robert A Duff
2000-02-16  0:00                                   ` Samuel T. Harris [this message]
2000-02-16  0:00                                     ` Robert A Duff
2000-02-17  0:00                                       ` Samuel T. Harris
2000-02-12  0:00                         ` blaak
2000-02-12  0:00                         ` Samuel T. Harris
2000-02-14  0:00                     ` scripting/extension language for Ada (was : Re: tagged types extensions) Robert A Duff
2000-02-04  0:00               ` Stanley R. Allen
2000-02-04  0:00                 ` Samuel T. Harris
2000-02-05  0:00                   ` Lionel Draghi
2000-02-05  0:00                     ` Samuel T. Harris
2000-02-06  0:00                       ` Bryce Bardin
2000-02-08  0:00                         ` Samuel T. Harris
2000-02-06  0:00                       ` Lionel Draghi
2000-02-05  0:00                 ` Ray Blaak
2000-02-05  0:00                 ` Lionel Draghi
2000-02-05  0:00             ` scripting/extension language for Ada (was : Re: tagged typesextensions) Lionel Draghi
2000-02-05  0:00           ` scripting/extension language for Ada (was : Re: tagged types extensions) Ehud Lamm
2000-02-06  0:00             ` Lionel Draghi
2000-02-06  0:00               ` scripting/extension language for Ada Terry Westley
2000-02-06  0:00               ` scripting/extension language for Ada (was : Re: tagged types extensions) Ehud Lamm
2000-02-09  0:00               ` Robert A Duff
2000-01-31  0:00 ` tagged types extensions - language design question Mark Lundquist
2000-02-01  0:00   ` Ehud Lamm
2000-02-01  0:00   ` Vladimir Olensky
2000-02-01  0:00   ` Simon Wright
replies disabled

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