Files
mgmt/lang/interpret_test/TestAstFunc2/class-include-as-nested0.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

27 lines
604 B
Plaintext

-- main.mcl --
$top = "top-level"
class base($s) {
test ["middle " + $s,] {}
$middle = "inside base"
}
# syntactic sugar for the equivalent of defining a class `inner` inside of base.
class base:inner($s) {
test ["inner " + $s,] {}
$last = "i am inner and i can see " + $middle
}
include base("world") as b1
include b1.inner("hello") as b2 # inner comes out of `base`
test "${top}" {}
test "${b1.middle}" {}
test "${b2.last}" {}
-- OUTPUT --
Vertex: test[inner hello]
Vertex: test[middle world]
Vertex: test[top-level]
Vertex: test[inside base]
Vertex: test[i am inner and i can see inside base]