Implicitly lazy gather/take not considered a "lazy" object

jjm*_*elo 7 lazy-evaluation perl6

The documentation for gather/take mentions

Binding to a scalar or sigilless container will also force laziness.

However,

my \result = gather { for 1..3 { take $_² } };
say result.is-lazy # OUTPUT: «False?»  
Run Code Online (Sandbox Code Playgroud)

Same happens if you use a scalar, and binding using := Is there some way to create implicitly lazy gather/take statements?

Update: It's actually lazy, only it does not respond to the is-lazy method in the expected way:

my $result := gather { for 1..3 { say "Hey"; take $_² } };
say $result[0] # OUTPUT: «Hey?1?»
Run Code Online (Sandbox Code Playgroud)

So the question is "What are the conditions for is-lazy to consider things actually lazy?"

Eli*_*sen 9

我认为问题实际上是您无法真正知道gather块中发生了什么。这就是为什么该Seq对象告诉您它不是惰性的原因。

也许是更多的文档的问题:如果is-lazy回报率True,那么你可以肯定的是,Seq(好吧,其实它的背后Iterator)是不会自行结束。如果is-lazy返回False,则基本上意味着我们不能确定。

有人可能会争辩说,在那种情况下is-lazy应该返回Bool类型对象,该类型对象也将被解释为假(因为所有类型对象都被认为是False布尔上下文)。但这至少会表明它确实是不确定的/不确定的。