Files
mgmt/lang/interpret_test/TestAstFunc1/polydoubleinclude.txtar
James Shubin 37bb67dffd lang: Improve graph shape with speculative execution
Most of the time, we don't need to have a dynamic call sub graph, since
the actual function call could be represented statically as it
originally was before lambda functions were implemented. Simplifying the
graph shape has important performance benefits in terms of both keep the
graph smaller (memory, etc) and in avoiding the need to run transactions
at runtime (speed) to reshape the graph.

Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
2025-04-27 22:14:51 -04:00

37 lines
1.1 KiB
Plaintext

-- main.mcl --
import "fmt"
# note that the class can have two separate types for $b
include c1("t1", "hello") # len is 5
include c1("t2", [13, 42, 0, -37,]) # len is 4
class c1($a, $b) {
test "${a}" {
anotherstr => fmt.printf("len is: %d", len($b)),
}
}
-- OUTPUT --
Edge: composite: []int -> len # 0
Edge: const: int(-37) -> composite: []int # 3
Edge: const: int(0) -> composite: []int # 2
Edge: const: int(13) -> composite: []int # 0
Edge: const: int(42) -> composite: []int # 1
Edge: const: str("hello") -> len # 0
Edge: const: str("len is: %d") -> printf: func(format str, a int) str # format
Edge: const: str("len is: %d") -> printf: func(format str, a int) str # format
Edge: len -> printf: func(format str, a int) str # a
Edge: len -> printf: func(format str, a int) str # a
Vertex: composite: []int
Vertex: const: int(-37)
Vertex: const: int(0)
Vertex: const: int(13)
Vertex: const: int(42)
Vertex: const: str("hello")
Vertex: const: str("len is: %d")
Vertex: const: str("len is: %d")
Vertex: const: str("t1")
Vertex: const: str("t2")
Vertex: len
Vertex: len
Vertex: printf: func(format str, a int) str
Vertex: printf: func(format str, a int) str