TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Date: Fri, 23 Apr 1999 09:39:00 -0500
Reply-To: Samuel Mize <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
In-Reply-To: <[log in to unmask]> from "Jens Jakob Jensen" at Apr 23, 99 11:48:19 am
Content-Type: text/plain; charset=US-ASCII
From: Samuel Mize <[log in to unmask]>
Parts/Attachments: text/plain (37 lines)
Jens Jakob Jensen wrote:
> What about:
> declare
>     function Max (v1, v2, v3, v4, v5 : Float) return Float is
>     X := Max (23.0 - 6.5 * Y,
> --              Y,
  -- No need: This is always <= either Y+Z or Y-Z
>               Y + Z,
>               Y - Z,
>               Limit);

This limits you to exactly 5 parameters, which means, among
other things, that the call as written (with Y commented out)
won't compile.  The array notation allows for variable-length
parameter lists.

I would have loved to see Ada introduce a type-safe version
of variable-length parameter lists, but that's an entirely
different kettle of syntactic/semantic fish...

By the way, we don't know what type Z is, so we don't know
for sure that either Y+Z or Y-Z will be <= Y.

Of course, a poor coder may also have redefined "+" or "-"
for float, to do some special-purpose coding.  After all,
code is so much easier to read with user-defined infix
operators...  :-)

Sam Mize

Samuel Mize -- [log in to unmask] (home email) -- Team Ada
Fight Spam: see \\\ Smert Spamonam