Niklas Keller wrote on 03/03/2015 12:52:
2015-03-03 13:27 GMT+01:00 Rowan Collins <rowan.coll...@gmail.com <mailto:rowan.coll...@gmail.com>>:

    Bob Weinand wrote on 03/03/2015 12:08:

        Why should the word "return" be unique to methods or functions?


    It just doesn't feel like the same thing as a return value to me,
    for the same reason a generator doesn't feel like the same thing
    as a function. In "function foo() { return 42; }", "return" means
    "this is what you'll get when you run foo()"; in "function foo() {
    return 42; yield; }", what you get when you run foo() is a pointer
    to the resumable state, and return means "this is what you'll get
    if you ask the generator/coroutine instance you get by running
    foo() for its final result".


It's still different from "return". You said, it "mark[s] the final result", so I'd expect that finally yielded value would be at the iterator, but it's not. It's separate.

How would you call the method then, that makes that "yield final" value available?

You mean instead of ->getReturn()? Something like ->getFinalValue() or ->getFinalResult()

Regards,
--
Rowan Collins
[IMSoP]

Reply via email to