Re: Proposal for variadic functions

> Perhaps we shouldn't even allow non-global functions to be variadic.

Seems like a reasonable constraint to me.

> My thinking is it's needed for backwards compatibility, but it doesn't
> need to be special-cased. If a call to F(a, b, c, d) with four
> positional arguments would be legal then we can make F#4 return a
> "virtual" non-variadic function that performs that call.

I like that.

>> I could write:
>> 
>>  f(1) ===> f(1, array {})
>>  f(1, 3, 4, 5) ==> f(1, array { (3,4,5) })
>>  f(1, array { (3,4,5) }) ===> f(1, array { array { (3,4,5) }})
>>  f(1, $y=array { (3,4,5) }) ===> f(1, array { (3,4,5) })
>> 
>> Is that right?
>
> Yes; but the third call would be a type error, because you're
> supplying an array of arrays where an array of integers is required.

Yes, I wrote array(*) initially and then changed it for no good reason.

> IIRC array{ (3,4,5) } is an array holding one member whose value is
> the sequence (3,4,5)? But I need to check. I think you meant the array
> [3,4,5].

Hmm. Okay. I thought (I think I’ve used it as) an array constructor, but
I could be wrong.


                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Tuesday, 8 December 2020 10:42:26 UTC