Skip to content

Commit d637c3a

Browse files
committed
add comment
1 parent 276e867 commit d637c3a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

unpythonic/syntax/tailtools.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,21 @@ def cc(*rets, **kwrets):
751751
if cc1 is not None:
752752
@passthrough_lazy_args
753753
def cc(return_value):
754+
# Return values are never implicitly lazy in `unpythonic`,
755+
# so why we need to `force1` here requires a comment.
756+
#
757+
# In general, we should treat these `cc` functions as lazy,
758+
# so they won't force their args. Those args here are a return value,
759+
# but due to `continuations`, it's not just a return, but a call
760+
# into the `cc` function.
761+
#
762+
# Thus, returning a `Values` from a continuation-enabled function,
763+
# that `Values` ends up here (or in the other branch, with no `cc1`).
764+
# Because it's *technically* an argument for a lazy function, it gets
765+
# a `lazy[]` wrapper added by `with lazify`.
766+
#
767+
# To determine whether we have one or multiple return values, we must
768+
# force that wrapper promise, without touching anything inside.
754769
return_value = force1(return_value)
755770
if isinstance(return_value, Values):
756771
return jump(cc1, cc=cc2, *return_value.rets, **return_value.kwrets)

0 commit comments

Comments
 (0)