On Thu, 9 Mar 2006, L505 wrote:
I have also read people stating things like this before:
"you can use array of const but you can't make functions like writeln
because writeln accepts multiple types".
Usually the statement is about different _numbers_ of arguments, not
different types. Writing subroutine which accept different types for
their arguments has never been a problem in Pascal.
I was talking specifically about array of const, not Pascal in general. The docs
do not make it clear that array of const can accept different types in "one
call". We are talking purely about "array of const" here, not the Pascal
language in general. Of course I know the Pascal language can accept multiple
types in one call.
But in fact, with array of const, you can use multiple types.
You can, just as you can use different types in record types.
Still, the actual argument type would be the type of the record or, as in
your case "array of const" then. Don't confuse that.
Well you are nitpicking my email :-). I'm not confused at all - the docs are.
As the author of the docs, I feel compelled to protest:
"This is a special case of the Open array construction, where it is
allowed to pass any expression in an array to a function or procedure."
The "any expression" is the keyword here...
But, to make it more explicit, I have added
"Each element of the array can have a different type."
And have added some examples where the elements have different types.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal