customasm icon indicating copy to clipboard operation
customasm copied to clipboard

Feature request: functions with variable numbers of arguments

Open skwerlman opened this issue 6 months ago • 0 comments

I'd like to be able to define a function which accepts a variable (within a known range) number of arguments, to be used like this:

foo(1, 2)
foo(1, 2, 3, 4)

I can think of 2 possible ways I might want to be able to define it, default argument values or multiple definitions. For my use case either one will work, though I think multiple definitions is the better one (and it can emulate default values pretty trivially)

; default values
#fn foo(a, b, c=3, d=4) => { ... }

; multiple definitions
#fn foo(a, b) => { ... }
#fn foo(a, b, c, d) => { ... }

skwerlman avatar Jan 04 '24 02:01 skwerlman