On Jan 8, 2008 10:11 PM, Florian Frank <flori / nixe.ping.de> wrote:
> Yukihiro Matsumoto wrote:
> > In 1.9, the warning was caused by the better value analysis.  The line
> > is essentially same as
> >
> >   a = (b.shift or break)
> >
> > which really is using void value.
>
> Hmm, but if this is "true or break" it still fails. Or do you mean by
> using, that one operatand of "or" results in a void value? Wouldn't that
> break the short-circuit semantics of "or" in this case?

Short-circuit semantics of "or" are introduced only at run time; the
void value check, if I understand it correctly, is a parse time check.

From your original example, I would rewrite it as:

  b = [1,2,3]
  loop {
    # move the assignment to a closer to b.shift
    if true then a = b.shift or break end
    p a
  }

As I understand it, this will not raise the error as the "return
value" (the void value in question) of "break" is no longer
(potentially) used.

Jacob Fugal