Qui, 2008-06-26 às 16:03 +0200, Moritz Lenz escreveu:
> In the test suite there are some tests like this:
> is(1.WHAT, 'Int', '1 as a literal is an Int);
> This seems to imply that we guarantee the direct type of literals. But
> do we?
> Actually I see no need for that. All my programs work fine if
> "RR" == Ryan Richter <[EMAIL PROTECTED]> writes:
RR> On Thu, Jun 26, 2008 at 09:55:09AM -0700, Larry Wall wrote:
>> We could go as far as to guarantee that Nums do rational arithmetic
>> out to a certain point, but probably what the financial insitutions
>> want is special fixed-poin
On Thu, Jun 26, 2008 at 1:31 PM, <[EMAIL PROTECTED]> wrote:
> Most financial institutions don't use float, rational or fixed point, they
> just keep integer pennies.
I'm not so sure about that. There are lots of financial transactions
that deal in sub-$0.01 fractions: taxes, currency conversion,
On Thu, Jun 26, 2008 at 09:46:25AM -0700, Larry Wall wrote:
: the VM somehow sneaks in the appropriate conversion for us if we
: actually try to pass an Int to a Rat.
I'd point out that this is fundamentally the same decision point that
is reached when we want to do boxing, because we basically ha
Most financial institutions don't use float, rational or fixed point, they just
keep integer pennies.
--
Mark Biggar
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-- Original message --
From: Larry Wall <[EMAIL PROTECTED]>
> Would any financial instituti
On Thu, Jun 26, 2008 at 04:03:42PM +0200, Moritz Lenz wrote:
: In the test suite there are some tests like this:
: is(1.WHAT, 'Int', '1 as a literal is an Int);
:
: This seems to imply that we guarantee the direct type of literals. But
: do we?
:
: Actually I see no need for that. All my programs
On Thu, Jun 26, 2008 at 09:55:09AM -0700, Larry Wall wrote:
> We could go as far as to guarantee that Nums do rational arithmetic
> out to a certain point, but probably what the financial insitutions
> want is special fixed-point types that assume a divisor anyway.
> Would any financial institution
On Thu, Jun 26, 2008 at 12:45:39PM -0400, Mark J. Reed wrote:
: Moritz Lenz> 3.14 would be a Rat or a Float or whatever
:
: That's a good question, actually. Does the literal "3.14" get turned
: into a Float or a Rat? Float is probably simplest, and matches what
: e.g. Lisp does, but you could a
On Thu, Jun 26, 2008 at 04:50:21PM +0200, Moritz Lenz wrote:
: I assume that 'Num' is meant to be a non-complex.
: Then it seems to make sense to assume:
: Int is Rat
: Rat is Num
: Num is Complex
: or am I off again?
Well, there's this little thing called Liskov substitutability...
Neither "is"
Moritz Lenz> 3.14 would be a Rat or a Float or whatever
That's a good question, actually. Does the literal "3.14" get turned
into a Float or a Rat? Float is probably simplest, and matches what
e.g. Lisp does, but you could argue either way. Especially since many
exact decimal literals become ap
On Thu, Jun 26, 2008 at 04:50:21PM +0200, Moritz Lenz wrote:
> What's the alternative?
> I don't think it's a good idea to special-case numeric types, and I
> don't think it's a good idea to define multis for each numeric type either.
>
> I assume that 'Num' is meant to be a non-complex.
> Then it
On Thu, Jun 26, 2008 at 10:40:53AM -0400, Trey Harris wrote:
> In a message dated Thu, 26 Jun 2008, Moritz Lenz writes:
> >I assume that 'Num' is meant to be a non-complex.
> >Then it seems to make sense to assume:
> >Int is Rat
> >Rat is Num
> >Num is Complex
> >or am I off again?
>
> S29 seems t
Trey Harris wrote:
> In a message dated Thu, 26 Jun 2008, Moritz Lenz writes:
>> I assume that 'Num' is meant to be a non-complex.
>> Then it seems to make sense to assume:
>> Int is Rat
>> Rat is Num
>> Num is Complex
>> or am I off again?
>
> S29 seems to have been assuming this, if I'm reading
In a message dated Thu, 26 Jun 2008, Moritz Lenz writes:
I assume that 'Num' is meant to be a non-complex.
Then it seems to make sense to assume:
Int is Rat
Rat is Num
Num is Complex
or am I off again?
S29 seems to have been assuming this, if I'm reading the multis correctly.
--
Trey Harris
Mark J. Reed wrote:
> On Thu, Jun 26, 2008 at 10:23 AM, Moritz Lenz
> <[EMAIL PROTECTED]> wrote:
>> Thanks for the effort, but it also raises new questions. For example:
>>> Int is Num
>> Rakudo doesn't do it that way, because the 'A is B' relation in OO means
>> "Every instance of A is also an Ins
On Thu, Jun 26, 2008 at 10:23 AM, Moritz Lenz
<[EMAIL PROTECTED]> wrote:
> Thanks for the effort, but it also raises new questions. For example:
>> Int is Num
> Rakudo doesn't do it that way, because the 'A is B' relation in OO means
> "Every instance of A is also an Instance of B", which certainly
(cross-posting to p6l)
Ryan Richter wrote:
> On Thu, Jun 26, 2008 at 11:36:05AM +0200, Moritz Lenz wrote:
>> 2) How do we know which numeric type is a class and which is a role? Is
>> there an explicit spec about the types of number literals? That could
>> have some impact on type checking in th
In the test suite there are some tests like this:
is(1.WHAT, 'Int', '1 as a literal is an Int);
This seems to imply that we guarantee the direct type of literals. But
do we?
Actually I see no need for that. All my programs work fine if the
literal 1 is of type Foo, and Foo isa Int.
What's our po
Another question:
Vasily Chekalkin (via RT) wrote:
> +.sub 'sqrt' :multi(Complex)
> +.param pmc a
> +a = sqrt a
> +.return (a)
> +.end
Do we actually want a sqrt(Complex)? Somebody who is sufficiently
mathematically educated to work with complex numbers should now that
sqrt() is ambig
Patrick R. Michaud wrote:
> Following up to a thread on p6c regarding method fallbacks and .join:
>
> * What should [1,3,5].join('-') produce?
I'm pretty sure it should be '1-3-5', because [1,3,5] is an Array ref
> * How about ([1,3,5], 20).join('-') ?
Probably the same as (~[1,3,5], 20).join
Following up to a thread on p6c regarding method fallbacks and .join:
* What should [1,3,5].join('-') produce?
* How about ([1,3,5], 20).join('-') ?
Thanks!
Pm
21 matches
Mail list logo