| 1 |
-- main.mcl -- |
| 2 |
# send/recv of value1.any into test.msg works! |
| 3 |
value "value1" { |
| 4 |
any => "i am value1", |
| 5 |
} |
| 6 |
test "test1" { |
| 7 |
sendvalue => "hello from test", |
| 8 |
|
| 9 |
Meta:autogroup => false, |
| 10 |
} |
| 11 |
value "value2" { |
| 12 |
any => "", # gets value from send_value above |
| 13 |
} |
| 14 |
value "value3" { |
| 15 |
# XXX: This works because this value gets overwritten, but it really |
| 16 |
# should get caught at type unification if possible. It is caught at |
| 17 |
# runtime and we allow it for now since we want the escape hatch with |
| 18 |
# the `any` types for the moment. The error looks like: |
| 19 |
# print[print1]: Error: could not SendRecv: |
| 20 |
# mismatch: value[value3].any (ptr) -> print[print1].msg (string): |
| 21 |
# cannot Into() 42 of type int into string |
| 22 |
any => "NOPE", # gets 42 |
| 23 |
} |
| 24 |
print "print1" {} |
| 25 |
|
| 26 |
Value["value1"].any -> Test["test1"].anotherstr |
| 27 |
Test["test1"].hello -> Value["value2"].any |
| 28 |
Test["test1"].answer -> Value["value3"].any |
| 29 |
Value["value3"].any -> Print["print1"].msg |
| 30 |
-- OUTPUT -- |
| 31 |
Edge: test[test1] -> value[value2] # test[test1] -> value[value2] |
| 32 |
Edge: test[test1] -> value[value3] # test[test1] -> value[value3] |
| 33 |
Edge: value[value1] -> test[test1] # value[value1] -> test[test1] |
| 34 |
Edge: value[value3] -> print[print1] # value[value3] -> print[print1] |
| 35 |
Field: test[test1].AnotherStr = "i am value1" |
| 36 |
Field: test[test1].SendValue = "hello from test" |
| 37 |
Field: value[value1].Any = "i am value1" |
| 38 |
Field: value[value2].Any = "hello from test" |
| 39 |
Field: value[value3].Any = 42 |
| 40 |
Vertex: print[print1] |
| 41 |
Vertex: test[test1] |
| 42 |
Vertex: value[value1] |
| 43 |
Vertex: value[value2] |
| 44 |
Vertex: value[value3] |