2011-06-22 02:38:07 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
a = ->
|
|
|
|
with something
|
|
|
|
print .hello
|
|
|
|
print hi
|
|
|
|
print "world"
|
2011-06-22 02:38:07 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
with leaf
|
|
|
|
.world!
|
|
|
|
.world 1,2,3
|
2011-06-22 02:38:07 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
g = .what.is.this
|
2011-06-22 02:38:07 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
.hi 1,2,3
|
2011-06-22 02:38:07 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
\hi(1,2).world 2323
|
2011-06-22 02:38:07 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
\hi "yeah", "man"
|
|
|
|
.world = 200
|
2011-06-22 02:38:07 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
zyzyzy = with something
|
|
|
|
.set_state "hello world"
|
2011-07-17 00:14:57 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
x = 5 + with Something!
|
|
|
|
\write "hello world"
|
2011-07-17 00:14:57 +00:00
|
|
|
|
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
x = {
|
|
|
|
hello: with yeah
|
|
|
|
\okay!
|
|
|
|
}
|
2011-07-17 00:14:57 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
with foo
|
|
|
|
\prop"something".hello
|
|
|
|
.prop\send(one)
|
|
|
|
.prop\send one
|
2011-07-17 00:14:57 +00:00
|
|
|
|
2011-11-02 02:54:13 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
do
|
|
|
|
with a, b -- b is lost
|
|
|
|
print .world
|
|
|
|
|
|
|
|
mod = with _M = {}
|
|
|
|
.Thing = "hi"
|
|
|
|
|
|
|
|
-- operate on a only
|
|
|
|
with a, b = something, pooh
|
|
|
|
print .world
|
|
|
|
|
|
|
|
x = with a, b = 1, 2
|
|
|
|
print a + b
|
|
|
|
|
|
|
|
print with a, b = 1, 2
|
|
|
|
print a + b
|
|
|
|
|
|
|
|
-- assignment lhs must be evaluated in the order they appear
|
|
|
|
p = with hello!.x, world!.y = 1, 2
|
|
|
|
print a + b
|
2012-11-01 14:27:52 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
x = "hello"
|
|
|
|
with x
|
|
|
|
x\upper!
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
with k = "jo"
|
|
|
|
print \upper!
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
with a,b,c = "", "", ""
|
|
|
|
print \upper!
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
a = "bunk"
|
|
|
|
with a,b,c = "", "", ""
|
|
|
|
print \upper!
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
with j
|
|
|
|
print \upper!
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2013-06-10 23:12:26 +00:00
|
|
|
do
|
|
|
|
with k.j = "jo"
|
|
|
|
print \upper!
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2015-09-05 15:01:28 +00:00
|
|
|
do
|
|
|
|
with a
|
|
|
|
print .b
|
|
|
|
-- nested `with`s should change the scope correctly
|
|
|
|
with .c
|
|
|
|
print .d
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2015-09-05 15:01:28 +00:00
|
|
|
do
|
|
|
|
with a
|
|
|
|
-- nested `with`s with assignments should change the scope correctly
|
|
|
|
with .b = 2
|
|
|
|
print .c
|
2012-11-01 14:27:52 +00:00
|
|
|
|
2015-09-27 04:16:02 +00:00
|
|
|
do
|
|
|
|
->
|
|
|
|
with hi
|
|
|
|
return .a, .b
|
|
|
|
|