in reply to Re^7: Unhappy returns
in thread Unhappy returns

by your argument, @x = do { for (1) { 1 } }; should be a syntax error, too, and it isn’t.

Huh? do {} is an expression that evaluates a block. (And like a function call, it too returns the value of the last expression evaluated.) Blocks may contain statements. How is that inconsistent with sauoq’s point?

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^9: Unhappy returns
by ysth (Canon) on Oct 11, 2005 at 04:33 UTC
    Careful, when you say "evaluates a block", you are almost coming right out and stating that a block has a return value :). Which was my point: what could it mean to evaluate a block containing only a for statement? If a for statement doesn't have a return value, it shouldn't even be valid syntax.