[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01108] Re: The value of while...

From: Dave Thomas <Dave@...>
Date: 2000-01-12 00:27:57 UTC
List: ruby-talk #1108
matz@netlab.co.jp (Yukihiro Matsumoto) writes:

> Are there any realistic need for using the `while' value?

Not now, but I rather like the idea of

a = (  while <something>
        <stuff>
        break <value> if ...
        <stuff>
      end
    )

(which I know I can do with a proc, but...)

> Some expressions (e.g. while, break, etc.) are marked as void
> expression by the parser.  I can relax them very easily if they bother
> you rather than helping you.

It's more the philosophical thing - we say that they are expressions,
and they generate values like expressions, but you can't use them as
expressions. Ruby's pretty good at being orthogonal, but it breaks
down a bit here.


Dave

In This Thread