Files
mgmt/lang/interpret_test/TestAstFunc2/printfinterpolate0.txtar
James Shubin 51cf1e2921 lang: ast: The res and edge names should not use exclusives
This removes the exclusive from the res names and edge names. We now
require that the names should be lists of strings, however they can
still be single strings if that can be determined statically.
Programmers should explicitly wrap their variables in a string by
interpolation to force this, or in square brackets to force a list. The
former is generally preferable because it generates a small function
graph since it doesn't need to build a list.
2024-04-18 00:07:53 -04:00

20 lines
632 B
Plaintext

-- main.mcl --
import "fmt"
$str1 = "big"
$str2 = "world"
# FIXME: We'd like to pre-compute the interpolation if we can, so that we can
# check this code statically... For now, we can't, so it's only possible with
# the PrintfAllowNonStaticFormat option enabled. This isn't bad per se, however
# any static compilation/optimization we can by "running early" would be great.
test [fmt.printf("hello ${str1} %s", $str2),] {}
test ["hello " + "small" + " " + $str2,] {}
print "print1" {
msg => fmt.printf("hello ${str1} %s", $str2),
}
-- OUTPUT --
Vertex: test[hello big world]
Vertex: test[hello small world]
Vertex: print[print1]