feat: add overloaded IO.print methods accepting 2-16 arguments and printList_ helper

Add 15 static overloads of IO.print in builtin/io.wren and src/wren_io.c, each delegating to a new private printList_ method that iterates over a list of objects. Update all benchmark and test files to use the new multi-argument syntax, removing explicit .toString calls and string concatenation. Add a comprehensive test/io/print.wren verifying single-argument return value, multi-argument null return, and concatenation of up to 16 arguments.
This commit is contained in:
Bob Nystrom
2014-04-09 14:48:35 +00:00
parent 786e20ba93
commit 3e5fdc2250
14 changed files with 176 additions and 25 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
var f0 = new Fn { IO.print("zero") }
var f1 = new Fn {|a| IO.print("one " + a) }
var f2 = new Fn {|a, b| IO.print("two " + a + " " + b) }
var f3 = new Fn {|a, b, c| IO.print("three " + a + " " + b + " " + c) }
var f1 = new Fn {|a| IO.print("one ", a) }
var f2 = new Fn {|a, b| IO.print("two ", a, " ", b) }
var f3 = new Fn {|a, b, c| IO.print("three ", a, " ", b, " ", c) }
f0.call("a") // expect: zero
f0.call("a", "b") // expect: zero