V: Ability to call variadic functions without any arguments

Created on 8 Nov 2019  路  2Comments  路  Source: vlang/v

Currently if you call a variadic function without any arguments, it results in quite a verbose error.
e.g.

fn variadic(args ...string){}
fn main(){
   variadic() //error
}

Either this should be handled properly i.e. output a proper error that you cannot call a variadic function without arguments or vargs should be treated as an array and should default to an empty array in case there are no arguments.

Bug Confirmed Compiler Type System

Most helpful comment

Indeed, your example should work.

All 2 comments

Indeed, your example should work.

Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

choleraehyq picture choleraehyq  路  3Comments

taojy123 picture taojy123  路  3Comments

markgraydev picture markgraydev  路  3Comments

penguindark picture penguindark  路  3Comments

lobotony picture lobotony  路  3Comments