On 2009-Feb-23, at 11:30 pm, Carl Mäsak wrote:
For what it's worth, I write a lot of Perl 6, and I'm already used to it.

OK. Of course, you might be smarter than the average coder, but I agree it's not a huge deal.

On 2009-Feb-24, at 9:29 am, Mark J. Reed wrote:
On Tue, Feb 24, 2009 at 11:16 AM, Ruud H.G. van Tol <rv...@isolution.nl > wrote:
David Green wrote:
   my $foo is limited(100..200);
   $foo = 5;                       # really does $foo = 100

Where does that MySQ smell come from?  Why not undef (or NaN)?
How about Failing instead of any of the above? Silently replacing the assigned value seems like a Bad Idea.

MySQL does stuff like that silently, which is a problem. But it's OK if you ask for it.
In fact, why not all of the above:

    my Int where {100 <= $_ <= 200} $foo;
    $foo = 5;    # failure!

    my Int where {100 <= $_ <= 200} $foo is silently-set-to(NaN);
    $foo = 5;    # does $foo = NaN

    my Int where {100 <= $_ <= 200} $foo is auto-kept-within-limits;
    $foo = 5;    # does $foo = 100

Except with better names...

On 2009-Feb-24, at 10:30 am, Larry Wall wrote:
Alternately, if you want a purer FP solution:
   take $foo clamp 100..200;
   take $bar clamp $midpoint ± $epsilon;

That's a much better name! But why "take" instead of "$foo clamp= 100..200"?
(Maybe the answer is "why not?", but I might be missing the point.)


Reply via email to