Skip to content

Commit

Permalink
examples: lang: Fixup a few examples
Browse files Browse the repository at this point in the history
We might change unification to allow naked single strings with fancier
unification, but let's leave it as is for now and see how often it comes
up.
  • Loading branch information
purpleidea committed Jul 3, 2024
1 parent d1753c5 commit e747e12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions examples/lang/class-include-nested0.mcl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
$top = "top-level"
class base($s) {
test "middle " + $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 {}
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 {}
test [$top,] {}
test [$b1.middle,] {}
test [$b2.last,] {}
18 changes: 9 additions & 9 deletions examples/lang/class-include-nested1.mcl
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
$top = "top-level"
class base($s) {
test "middle " + $s {}
test ["middle " + $s,] {}
$middle = "inside base"
}

# syntactic sugar for the equivalent of defining a class `inner` inside of base.
class base:inner1($s) {
test "inner1 " + $s {}
test ["inner1 " + $s,] {}

$last = "i am inner1 and i can see " + $middle
}

class base:inner2($s) {
test "inner2 " + $s {}
test ["inner2 " + $s,] {}

$last = "i am inner2 and i can see " + $middle
}

# three deep!
class base:inner1:deep($s, $b) {
test "deep is " + $s {}
test ["deep is " + $s,] {}

$end = "i am deep and i can see " + $middle + " and last says " + $last
}
Expand All @@ -29,8 +29,8 @@ include b0.inner1("hello") as b1 # inner comes out of `base`
include b0.inner2("hello") as b2 # inner comes out of `base`
include b1.deep("deep", true) as d # deep comes out of `inner1`

test $top {}
test $b0.middle {}
test $b1.last {}
test $b2.last {}
test $d.end {}
test [$top,] {}
test [$b0.middle,] {}
test [$b1.last,] {}
test [$b2.last,] {}
test [$d.end,] {}

0 comments on commit e747e12

Please sign in to comment.