I'm studying Ada because I am intrigued by the idea of strict type safety and programming contracts. The idea of "programming for forever" is nice. Anyway, the real question is whether or not Ada has variadic functions. A search on SO suggests that Ada doesn't, and the correct way to do this is with an unconstrained array whose length is determined at runtime.
My question then, isn't how do you do it, but rather what is the convention for doing it correctly?
Additionally, why is it that Ada can perform (what appear to be stack-based) operations like + (e.g. 1+2+3), but it cannot do the same for arguments to a function call?
Is it more idiomatic to not do variadic expressions at all like
Max(1, 2, 3, ..., n), or is it simply that you should pass the arguments to it like Args.len=n; Max(Args[])?
My instinct and what I've gleaned from reading the various Ada books suggests that you shouldn't have unspecific functions due to them being less safe.
1+2+3. First of all, there's nothing stack-based about it. Normally, if the arguments were variables, it would be adding registers together and putting the result in another register, and it wouldn't come anywhere near the stack. Second, your question seems to imply that there's something "variadic" about+, but there isn't."+"is a function that takes two arguments, period. You want to add more numbers, you have to call the function multiple times. Which you can do with any other function in Ada (Func(a,Func(b,Func(c,...)))). - ajb