develooper Front page | perl.perl6.language | Postings from November 2010

Re: exponentiation of Duration's

Thread Previous | Thread Next
From:
Moritz Lenz
Date:
November 17, 2010 03:03
Subject:
Re: exponentiation of Duration's
Message ID:
4CE3B69B.3020206@faui2k3.org
Am 17.11.2010 10:31, schrieb Kris Shannon:
> A recent rakudo commit [1] is a quick fix for #78896 [2] to allow
> exponentiation of Duration's.

And it did so with a real world use case in mind.

> I'm uneasy with allowing this and I think the spec probably meant not
> to but is badly worded [3]:
>
>   Durations allow additive operations with other durations, and allow
>   any numeric operation with a number as the other argument:
>
>       $duration * $duration    # WRONG, durations aren't geometric
>       $duration * 2            # ok, a duration twice as long
>       2 * $duration            # same
>
> What are your thoughts?

I've summarized my thoughts here, before I read your email: 
http://perlgeek.de/blog-en/perl-6/real-world-strikes-back.html

Another example: current Duration % Duration is forbidden. But I have a 
very good use case:

suppose I want to organize a 60 minutes session, and it's filled with 
presentations, each 8 minutes long. How long do I have for the 
introduction, if I fit in as many presentations as possible?

The operation $session_duration % $presentation_duration answers me 
that. Why am I not allowed to carry out that operation? Because some 
designer thought I'd be better off not doing that operation. Wow, 
awesome reason</sarcasm>.

> [1] https://github.com/rakudo/rakudo/commit/d9e22463479927fa8f1f594753979022de35970d
> [2] http://rt.perl.org/rt3/Ticket/Display.html?id=78896
> [3] https://github.com/perl6/specs/commit/32abb95b9776e1cb7672c8a6a77612c86b37aea2#L0R1333

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About