Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration disallows some numeric operations with a number as the other argument in Rakudo #2248

Closed
p6rt opened this issue Nov 7, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 7, 2010

Migrated from rt.perl.org#78896 (status was 'resolved')

Searchable as RT78896$

@p6rt
Copy link
Author

p6rt commented Nov 7, 2010

From @masak

<masak> I just got "Can't exponentiate a Duration" in real-world code.
could someone explain to me why we have Durations?
<masak> I was calculating the standard deviation of a bunch of
Durations. that calculation contains an exponantiation.
<masak> I know what I'm doing. Rakudo thought it knew better, it didn't.
<masonkramer> I'm not even sure that your failure was to spec
<masak> I'm pretty sure it isn't.
<masonkramer> "Durations allow additive operations with other
durations, _and allow any numeric operation with a number as the other
argument_"
* masak submits rakudobug
<masonkramer> So it wouldn't have been an issue for you if it had been to spec
<masak> masonkramer​: thank you.

@p6rt
Copy link
Author

p6rt commented Nov 11, 2010

From @Kodiologist

This restriction has been removed as of d9e224634.

@p6rt
Copy link
Author

p6rt commented Nov 11, 2010

@Kodiologist - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Nov 11, 2010
@p6rt
Copy link
Author

p6rt commented Nov 17, 2010

From kris@shannon.id.au

On Sun Nov 07 07​:57​:26 2010, masak wrote​:

<masonkramer> "Durations allow additive operations with other
durations, _and allow any numeric operation with a number as the other
argument_"

I don't think enough context was quoted (or paid atttention to)

The next line in the spec is​:

  $duration * $duration # WRONG, durations aren't geometric

which would seem to apply to exponentiation as well.

@p6rt
Copy link
Author

p6rt commented Nov 17, 2010

From @masak

masak (>>), Kris (>)​:

<masonkramer> "Durations allow additive operations with other
durations, _and allow any numeric operation with a number as the other
argument_"

I don't think enough context was quoted (or paid atttention to)

The next line in the spec is​:

    $duration * $duration    # WRONG, durations aren't geometric

which would seem to apply to exponentiation as well.

Taken literally, the spec allows "any numeric operation with a number
as the other argument". C<$duration ** 2> certainly qualifies as just
that. I sympathise with your extrapolation from multiplication, but it
seems to me that the explicit rule takes precedence.

Of course, the fundamental issue is whether restrictions of this kind
are actually helpful. My contention is that they're not.

Here's an article that moritz++ wrote about it​:
http://perlgeek.de/blog-en/perl-6/real-world-strikes-back.html

I agree with moritz' conclusion, that Duration should simply go away.
It doesn't add any obvious advantage over the number of seconds stored
in a Num or Rat.

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant