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... :-)
Best,
Sam Mize
--
Samuel Mize -- [log in to unmask] (home email) -- Team Ada
Fight Spam: see http://www.cauce.org/ \\\ Smert Spamonam
|