| 1 |
-- main.mcl -- |
| 2 |
# this currently fails with: "class `c1` does not exist in this scope" |
| 3 |
# instead of: "recursive class `c1` found" or "recursive class `c2` found" |
| 4 |
# ideally, we'd consider allowing finite (static) recursion such as this... |
| 5 |
import "fmt" |
| 6 |
$max = 5 |
| 7 |
include c1(0) # start at zero |
| 8 |
class c1($count) { |
| 9 |
if $count == $max { |
| 10 |
test "done" { |
| 11 |
stringptr => fmt.printf("count is %d", $count), |
| 12 |
} |
| 13 |
} else { |
| 14 |
include c2($count + 1) # recursion not supported atm |
| 15 |
} |
| 16 |
} |
| 17 |
class c2($count) { |
| 18 |
if $count == $max { |
| 19 |
test "done" { |
| 20 |
stringptr => fmt.printf("count is %d", $count), |
| 21 |
} |
| 22 |
} else { |
| 23 |
include c1($count + 1) # recursion not supported atm |
| 24 |
} |
| 25 |
} |
| 26 |
-- OUTPUT -- |
| 27 |
# err: errSetScope: recursive reference while setting scope: not a dag |