> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Date: Fri, 15 Nov 2002 07:05:26 +1100 (EST)
> From: "Timothy S. Nelson" <[EMAIL PROTECTED]>
> Sender: [EMAIL PROTECTED]
> X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
>
> Hi all. I missed out on the original RFC process; it was over before
> I even heard of perl6.
Right. Me too. But, as you'll notice, this is certainly not keeping
it from changing :)
> Anyway, there's something I want to contribute to the Perl
> community. I've had an idea about control structures which I've
> never seen anywhere else, so I guess I'm the inventor :). I hope
> this is the appropriate forum to do it; it looks to me like it is,
> but I could be wrong.
Yes, it is.
> Anyway, the first part is the given statement modified to fit this
> idea. It'd run something like this:
>
> --------------------------------------------------------------
> given ($this) {
> when $that_happens { "Have a party" }
> when $that_doesnt_happen { "Sing" }
> all {
> # Do something
> }
> any {
> # Do something else
> }
> some {
> # Do something other
> }
> none {
> # Do something however
> }
> }
> --------------------------------------------------------------
>
> The basic idea is that you have two "special" variables which
> I will, just for now, call $truecount and $falsecount. Basically,
> every time one of the "when" clauses comes up true, it increments
> truecount; whenever one comes up false, it increments $falsecount.
> The blocks below the given get evaluated under the following
> conditions
> all: $falsecount == 0
> any: $truecount > 0
> some: $falsecount > 0
> none: $truecount == 0
>
> So anyway, "none" replaces the old "default" option, and the others
> can be useful from time to time too :).
Well, it's an interesting idea, but I don't think it's necessary. I
honestly don't recall a time when this would be useful. Perhaps a
sane example could convince me otherwise...
(As a rule of thumb, always include sane, real-world-like examples in
proposals)
Luke