TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Samuel Mize <[log in to unmask]>
Reply To:
Samuel Mize <[log in to unmask]>
Fri, 23 Apr 1999 09:39:00 -0500
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