diff --git a/lib/Minilisp.pm b/lib/Minilisp.pm index 1429637..8fa1294 100644 --- a/lib/Minilisp.pm +++ b/lib/Minilisp.pm @@ -920,7 +920,7 @@ sub macro_do { my $body = macro_progn($ts); - return sub { + return create_block("nil", sub { my $octx = shift; my $ictx = ctx_create($octx); @@ -946,7 +946,7 @@ sub macro_do { } return $result_form->($ictx); - } + }); } $macros{do} = \¯o_do; diff --git a/t/do.t b/t/do.t index e9bad3c..58d2093 100644 --- a/t/do.t +++ b/t/do.t @@ -11,3 +11,10 @@ (comment lst) lst) (list 1 2 3))) + +(expect "do - has implicit block nil" + (equal 'ok + (block nil + (do () (t) + (return 'fail)) + 'ok)))