vtereshkov / umka-lang

Umka: a statically typed embeddable scripting language
BSD 2-Clause "Simplified" License
1k stars 53 forks source link

Functions with variadic parameters inconsistently handle newlines. #410

Closed skejeton closed 3 weeks ago

skejeton commented 3 weeks ago

Take a function like this:

fn logt*(fmt: str)

In this case, calling it like this would work:

logt(
  "Line 1\n"+
  "Line 2\n"
)

Take a similar function, like this:

fn logt*(fmt: str, args: ..any)

It should be compatible with the call signature of the previous function, but it's not:

logt(
  "Line 1\n"+
  "Line 2\n"
) // Illegal expression

The solution is to remove the final newline:

logt(
  "Line 1\n"+
  "Line 2\n")