Re: exponentiation of Duration's

2010-11-19 Thread Carl Mäsak
Darren (), Carl (), Darren (): Specific units, even seconds should not be mentioned at all in the definition of Instant or Duration; instead, any particular units or calendars or whatever would just be a property of the composing class. No disrespect, but it was the abandonment of abstracty

Re: exponentiation of Duration's

2010-11-18 Thread Martin D Kealey
On Wed, 17 Nov 2010, Richard Hainsworth wrote: Once a number has been generated, viz., by obtaining a duration, that number can be manipulated however necessary. The interpretation of the number is a matter for the programmer, not the language designer. All true. However I'd argue that you

Re: exponentiation of Duration's

2010-11-18 Thread Dave Whipp
On 11/17/2010 10:08 PM, Martin D Kealey wrote: Dimensioned numbers as restrictive types are useful, for uncovering bugs, including sometimes latent ones in ported code. Duration is a fairly clear example of a dimensioned quantity, and I think we should think twice about abandoning its

Re: exponentiation of Duration's

2010-11-18 Thread Darren Duncan
I think that Instant and Duration should simply be declarational roles that don't have any implementation code to compose. Composing Instant or Duration into a type simply says that the objects of that type represent a point on a timeline or an amount of time. Specific units, even seconds

Re: exponentiation of Duration's

2010-11-18 Thread Darren Duncan
To clarify, by define particular methods I mean that said 2 roles would require composing classes to define them, not to include the code themselves. -- Darren Duncan Darren Duncan wrote: I think that Instant and Duration should simply be declarational roles that don't have any implementation

Re: exponentiation of Duration's

2010-11-18 Thread Carl Mäsak
Darren (): Specific units, even seconds should not be mentioned at all in the definition of Instant or Duration; instead, any particular units or calendars or whatever would just be a property of the composing class. No disrespect, but it was the abandonment of abstracty stuff like this that

Re: exponentiation of Duration's

2010-11-18 Thread Darren Duncan
Carl Mäsak wrote: Darren (): Specific units, even seconds should not be mentioned at all in the definition of Instant or Duration; instead, any particular units or calendars or whatever would just be a property of the composing class. No disrespect, but it was the abandonment of abstracty

exponentiation of Duration's

2010-11-17 Thread Kris Shannon
A recent rakudo commit [1] is a quick fix for #78896 [2] to allow exponentiation of Duration's. 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

Re: exponentiation of Duration's

2010-11-17 Thread Moritz Lenz
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

Re: exponentiation of Duration's

2010-11-17 Thread Richard Hainsworth
On 11/17/10 14:03, Moritz Lenz wrote: Am 17.11.2010 10:31, schrieb Kris Shannon: $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

Re: exponentiation of Duration's

2010-11-17 Thread Moritz Lenz
Am 17.11.2010 12:55, schrieb Richard Hainsworth: On 11/17/10 14:03, Moritz Lenz wrote: Am 17.11.2010 10:31, schrieb Kris Shannon: $duration * $duration # WRONG, durations aren't geometric $duration * 2 # ok, a duration twice as long 2 * $duration # same What are your thoughts? I've

Re: exponentiation of Duration's

2010-11-17 Thread Oha
On 11/17/2010 01:46 PM, Moritz Lenz wrote: Just as a data point, in physics duration squared does exist. On the other hand, i can see why an Instant can't be used as a linear value: it does not have a clear origin (or zero value). Therefore the multiplication of two Instant may results in

Re: exponentiation of Duration's

2010-11-17 Thread Moritz Lenz
Am 17.11.2010 14:02, schrieb Oha: On 11/17/2010 01:46 PM, Moritz Lenz wrote: Just as a data point, in physics duration squared does exist. On the other hand, i can see why an Instant can't be used as a linear value: it does not have a clear origin (or zero value). That's correct, and the

Re: exponentiation of Duration's

2010-11-17 Thread Mark J. Reed
I'm not convinced that the type system shouldn't be helping with dimensional analysis, but at least it shouldn't hurt. By all means, let the programmer raise a Duration to a power - but the type of the result should not also be Duration. In the absence of automatic dimension tracking, just

Re: exponentiation of Duration's

2010-11-17 Thread Carl Mäsak
Mark (): I'm not convinced that the type system shouldn't be helping with dimensional analysis, but at least it shouldn't hurt.  By all means, let the programmer raise a Duration to a power - but the type of the result should not also be Duration.  In the absence of automatic dimension

Re: exponentiation of Duration's

2010-11-17 Thread Mason Kramer
I still have uses for Durations. For instance, I want to dispatch a different .Stringy method to Durations than to Nums. It's convenient to me that the difference between two Instants has a different type than the difference between 1654321681.123 and 1654321021.65438. I just think

Re: exponentiation of Duration's

2010-11-17 Thread Oha
On 11/17/2010 02:56 PM, Carl Mäsak wrote: Or, by Ockham, since Duration is now deprived of its only task -- making life harder for the programmer -- remove it altogether from the language and just put a number type in its place, representing number of seconds. I could be wrong but this

Re: exponentiation of Duration's

2010-11-17 Thread Steve Pitchford
On Wed, Nov 17, 2010 at 2:20 PM, Oha o...@oha.it wrote: I could be wrong but this reminds me that a Duration could not be only based in seconds, but also in other units (which may automagically be converted to seconds) and also those seconds may be leap or not. Maybe the point is that really

Re: exponentiation of Duration's

2010-11-17 Thread Moritz Lenz
Am 17.11.2010 15:20, schrieb Oha: On 11/17/2010 02:56 PM, Carl Mäsak wrote: Or, by Ockham, since Duration is now deprived of its only task -- making life harder for the programmer -- remove it altogether from the language and just put a number type in its place, representing number of seconds.

Re: exponentiation of Duration's

2010-11-17 Thread Jon Lang
If I'm following this correctly, shouldn't we just say that Duration does Num? That way, a Duration can be used exactly like a Num is (with units measured in seconds); but it could also have special capabilities above and beyond what a Num can do, if such capabilities are needed. More generally,

Re: exponentiation of Duration's

2010-11-17 Thread Moritz Lenz
Am 17.11.2010 17:50, schrieb Jon Lang: If I'm following this correctly, shouldn't we just say that Duration does Num? Num is a class (think floating point number). The role you're looking for is probably either Numeric or Real. If we say that Duration inherits from Rat or FatRat, it

Re: exponentiation of Duration's

2010-11-17 Thread Jon Lang
Moritz Lenz wrote: Am 17.11.2010 17:50, schrieb Jon Lang: More generally, I wonder if maybe we _should_ provide a tool to help I think this question can only be answered in a meaningful way if somebody actually implements such a thing as a module (which should be entirely possible in Rakudo