[EMAIL PROTECTED] (Luke Palmer) writes:
> I was reading the most recent article on perl.com, and a code segment
> reminded me of something I see rather often in code that I don't like.

The code in question got me thinking too; I wanted to find a cleaner
way to write it, but didn't see one.

> So, in Perl's postmodern tradition, I think we should steal that idea.

I agree, but (as usual) would like to consider whether there's a way
to solve a general problem rather than solving a specific problem by
throwing additional syntax at it. (which sadly seems to be fast becoming
the Perl 6 way)

Given that we've introduced the concept of "if" having a return status:

  my $result = if ($a) { $a } else { $b };

Then why not extend this concept and have a return status from other
control structures?

  for 0..6 -> $t { 
    last if abs(@new[$t] - @new[$t+1]) > 3;
  } or push @moves: [$i, $j];

Of course, these things have consequences; I'm not sure whether we really
want people saying

  push @moves:[$i, $j] unless last if abs(@[EMAIL PROTECTED])>3 for 0..6;

-- 
The course of true anything never does run smooth.
                -- Samuel Butler

Reply via email to