| 1 |
-- main.mcl -- |
| 2 |
$foo = "a" |
| 3 |
|
| 4 |
class c1($cond) { |
| 5 |
$foo = "b" # this var is NOT exported into the parent scope on include |
| 6 |
if $cond { |
| 7 |
$foo = "c" |
| 8 |
} |
| 9 |
test "hello" {} |
| 10 |
} |
| 11 |
include c1(true) |
| 12 |
|
| 13 |
# If the $foo did get exported from the `c1` scope, then the binding could |
| 14 |
# change over time as `$cond` alternated between true and false. This would be |
| 15 |
# error prone, and also require a higher-order FRP, which would add complexity |
| 16 |
# but little value. |
| 17 |
|
| 18 |
test "${foo}" {} |
| 19 |
-- OUTPUT -- |
| 20 |
Vertex: test[a] |
| 21 |
Vertex: test[hello] |