This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Sequence -> Seq

72 replies
Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq
When will the days of numerical overflow be gone?

On Fri, Oct 2, 2009 at 2:17 PM, Stepan Koltsov <stepan [dot] koltsov [at] gmail [dot] com> wrote:
On Fri, Oct 2, 2009 at 06:05, Nils Kilden-Pedersen <nilskp [at] gmail [dot] com> wrote:
> On Tue, Sep 22, 2009 at 2:22 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
>>
>> On Tue, Sep 22, 2009 at 02:17:25PM -0500, Nils Kilden-Pedersen wrote:
>> > Agreed. Now if we could only rename BigDecimal to just Decimal...
>>
>> I would like to do this actually, I just hadn't gotten around to
>> bringing it up.  Martin, can I have a thumbs up or down on renaming
>> scala.BigDecimal to scala.Decimal and deprecating the Big one?

"Big" in BigDecimal means that value has unlimited precision and
scale. Regular "Decimal" may be backed by single Long value. So I'm
0.1 against renaming.

S.



--
Viktor Klang

Blog: klangism.blogspot.com
Twttr: viktorklang

Lift Committer - liftweb.com
AKKA Committer - akkasource.org
Cassidy - github.com/viktorklang/Cassidy.git
SoftPub founder: http://groups.google.com/group/softpub
Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Sequence -> Seq

One second after 03:14:07 UTC on Tuesday, 19 January 2038

2009/10/2 Viktor Klang :
> When will the days of numerical overflow be gone?
>
> On Fri, Oct 2, 2009 at 2:17 PM, Stepan Koltsov
> wrote:
>>
>> On Fri, Oct 2, 2009 at 06:05, Nils Kilden-Pedersen
>> wrote:
>> > On Tue, Sep 22, 2009 at 2:22 PM, Paul Phillips
>> > wrote:
>> >>
>> >> On Tue, Sep 22, 2009 at 02:17:25PM -0500, Nils Kilden-Pedersen wrote:
>> >> > Agreed. Now if we could only rename BigDecimal to just Decimal...
>> >>
>> >> I would like to do this actually, I just hadn't gotten around to
>> >> bringing it up.  Martin, can I have a thumbs up or down on renaming
>> >> scala.BigDecimal to scala.Decimal and deprecating the Big one?
>>
>> "Big" in BigDecimal means that value has unlimited precision and
>> scale. Regular "Decimal" may be backed by single Long value. So I'm
>> 0.1 against renaming.
>>
>> S.
>
>
>
> --
> Viktor Klang
>
> Blog: klangism.blogspot.com
> Twttr: viktorklang
>
> Lift Committer - liftweb.com
> AKKA Committer - akkasource.org
> Cassidy - github.com/viktorklang/Cassidy.git
> SoftPub founder: http://groups.google.com/group/softpub
>

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Sequence -> Seq
If you were programming in ABC, it would have been gone already. :-)   OTOH, the case has been made to the effect that automatic fall back to arbitrary precision when detecting overflow isn't all that hard or time-consuming, and it ought to be the default, with limited precision being the exception. I agree with the sentiment, but there's inertia to be accounted for -- and we aren't even talking about things like backward compatibility or JVM architecture.

On Fri, Oct 2, 2009 at 9:27 AM, Viktor Klang <viktor [dot] klang [at] gmail [dot] com> wrote:
When will the days of numerical overflow be gone?

On Fri, Oct 2, 2009 at 2:17 PM, Stepan Koltsov <stepan [dot] koltsov [at] gmail [dot] com> wrote:
On Fri, Oct 2, 2009 at 06:05, Nils Kilden-Pedersen <nilskp [at] gmail [dot] com> wrote:
> On Tue, Sep 22, 2009 at 2:22 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
>>
>> On Tue, Sep 22, 2009 at 02:17:25PM -0500, Nils Kilden-Pedersen wrote:
>> > Agreed. Now if we could only rename BigDecimal to just Decimal...
>>
>> I would like to do this actually, I just hadn't gotten around to
>> bringing it up.  Martin, can I have a thumbs up or down on renaming
>> scala.BigDecimal to scala.Decimal and deprecating the Big one?

"Big" in BigDecimal means that value has unlimited precision and
scale. Regular "Decimal" may be backed by single Long value. So I'm
0.1 against renaming.

S.



--
Viktor Klang

Blog: klangism.blogspot.com
Twttr: viktorklang

Lift Committer - liftweb.com
AKKA Committer - akkasource.org
Cassidy - github.com/viktorklang/Cassidy.git
SoftPub founder: http://groups.google.com/group/softpub



--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq
On Fri, Oct 2, 2009 at 7:17 AM, Stepan Koltsov <stepan [dot] koltsov [at] gmail [dot] com> wrote:
On Fri, Oct 2, 2009 at 06:05, Nils Kilden-Pedersen <nilskp [at] gmail [dot] com> wrote:
> On Tue, Sep 22, 2009 at 2:22 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
>>
>> On Tue, Sep 22, 2009 at 02:17:25PM -0500, Nils Kilden-Pedersen wrote:
>> > Agreed. Now if we could only rename BigDecimal to just Decimal...
>>
>> I would like to do this actually, I just hadn't gotten around to
>> bringing it up.  Martin, can I have a thumbs up or down on renaming
>> scala.BigDecimal to scala.Decimal and deprecating the Big one?

"Big" in BigDecimal means that value has unlimited precision and
scale. Regular "Decimal" may be backed by single Long value. So I'm
0.1 against renaming.

Which "regular Decimal" is that of which you speak?

Stepan Koltsov
Joined: 2008-12-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Sequence -> Seq

On Fri, Oct 2, 2009 at 17:37, Nils Kilden-Pedersen wrote:
> On Fri, Oct 2, 2009 at 7:17 AM, Stepan Koltsov
> wrote:
>>
>> On Fri, Oct 2, 2009 at 06:05, Nils Kilden-Pedersen
>> wrote:
>> > On Tue, Sep 22, 2009 at 2:22 PM, Paul Phillips
>> > wrote:
>> >>
>> >> On Tue, Sep 22, 2009 at 02:17:25PM -0500, Nils Kilden-Pedersen wrote:
>> >> > Agreed. Now if we could only rename BigDecimal to just Decimal...
>> >>
>> >> I would like to do this actually, I just hadn't gotten around to
>> >> bringing it up.  Martin, can I have a thumbs up or down on renaming
>> >> scala.BigDecimal to scala.Decimal and deprecating the Big one?
>>
>> "Big" in BigDecimal means that value has unlimited precision and
>> scale. Regular "Decimal" may be backed by single Long value. So I'm
>> 0.1 against renaming.
>
> Which "regular Decimal" is that of which you speak?

There is no one in the scala or java standard library. But SQL
DECIMAL(a, b) type is such numeric.

BigInteger is an unlimited Integer.
BigDecimal is an unlimited Decimal.

S.

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq
On Fri, Oct 2, 2009 at 9:49 AM, Stepan Koltsov <stepan [dot] koltsov [at] gmail [dot] com> wrote:
BigInteger is an unlimited Integer.
BigDecimal is an unlimited Decimal.


The entire point is that since there is no Decimal data type, it's somewhat idiotic to have a Big version of... well, nothing. Hence the desire to just name it Decimal.
As an added benefit this also avoids the collision with Java's BigDecimal.
Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Sequence -> Seq

There's a decimal type in .NET, and it's not of an unlimited size.
http://www.yoda.arachsys.com/csharp/decimal.html

2009/10/2 Nils Kilden-Pedersen :
> On Fri, Oct 2, 2009 at 9:49 AM, Stepan Koltsov
> wrote:
>>
>> BigInteger is an unlimited Integer.
>> BigDecimal is an unlimited Decimal.
>>
>
> The entire point is that since there is no Decimal data type, it's somewhat
> idiotic to have a Big version of... well, nothing. Hence the desire to just
> name it Decimal.
> As an added benefit this also avoids the collision with Java's BigDecimal.
>

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: Sequence -> Seq

On Fri, Oct 2, 2009 at 5:05 PM, Ricky Clarkson wrote:
> There's a decimal type in .NET, and it's not of an unlimited size.
> http://www.yoda.arachsys.com/csharp/decimal.html
>
> 2009/10/2 Nils Kilden-Pedersen :
>> On Fri, Oct 2, 2009 at 9:49 AM, Stepan Koltsov
>> wrote:
>>>
>>> BigInteger is an unlimited Integer.
>>> BigDecimal is an unlimited Decimal.
>>>
>>
>> The entire point is that since there is no Decimal data type, it's somewhat
>> idiotic to have a Big version of... well, nothing. Hence the desire to just
>> name it Decimal.
>> As an added benefit this also avoids the collision with Java's BigDecimal.
>>
>
I think the principle of least change wins here as well.

Cheers

Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq


On Fri, Oct 2, 2009 at 5:16 PM, martin odersky <martin [dot] odersky [at] epfl [dot] ch> wrote:
On Fri, Oct 2, 2009 at 5:05 PM, Ricky Clarkson <ricky [dot] clarkson [at] gmail [dot] com> wrote:
> There's a decimal type in .NET, and it's not of an unlimited size.
> http://www.yoda.arachsys.com/csharp/decimal.html
>
> 2009/10/2 Nils Kilden-Pedersen <nilskp [at] gmail [dot] com>:
>> On Fri, Oct 2, 2009 at 9:49 AM, Stepan Koltsov <stepan [dot] koltsov [at] gmail [dot] com>
>> wrote:
>>>
>>> BigInteger is an unlimited Integer.
>>> BigDecimal is an unlimited Decimal.
>>>
>>
>> The entire point is that since there is no Decimal data type, it's somewhat
>> idiotic to have a Big version of... well, nothing. Hence the desire to just
>> name it Decimal.
>> As an added benefit this also avoids the collision with Java's BigDecimal.
>>
>
I think the principle of least change wins here as well.

Agreed,
however,
it would be a great step forward to have as a goal to have unlimited precision integers and decimals (and do away with the others/invisiboxing) planned for something like Scala 3.0
 

Cheers

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq
On Fri, Oct 2, 2009 at 10:20 AM, Viktor Klang <viktor [dot] klang [at] gmail [dot] com> wrote:
it would be a great step forward to have as a goal to have unlimited precision integers and decimals (and do away with the others/invisiboxing) planned for something like Scala 3.0

Several people have now called BigDecimal "unlimited". That is nonsensical. It is of arbitrary, and limited, precision, just like float and double. And it would be impossible, and useless even, to come up with anything that has "unlimited" precision.

I still find BigDecimal an annoying name, considering that there won't ever be a Decimal class, but thanks to Scala (Martin really), I can just rename it myself.
Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Sequence -> Seq

There might one day be a Decimal class in Scala, as Scala also targets
.NET, which has System.Decimal as a primitive type.

2009/10/2 Nils Kilden-Pedersen :
> On Fri, Oct 2, 2009 at 10:20 AM, Viktor Klang
> wrote:
>>
>> it would be a great step forward to have as a goal to have unlimited
>> precision integers and decimals (and do away with the others/invisiboxing)
>> planned for something like Scala 3.0
>
> Several people have now called BigDecimal "unlimited". That is nonsensical.
> It is of arbitrary, and limited, precision, just like float and double. And
> it would be impossible, and useless even, to come up with anything that has
> "unlimited" precision.
>
> I still find BigDecimal an annoying name, considering that there won't ever
> be a Decimal class, but thanks to Scala (Martin really), I can just rename
> it myself.
>

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Sequence -> Seq
That depends on your definition of "limited". It's commonly accepted that "limited precision" refers to a precision that is fixed, while "unlimited precision" refers to precision that varies with need and is only limited by external resources such as address space and memory.   So, no matter how you define "limited", the fact is that BigDecimal is completely different than float and double.

On Fri, Oct 2, 2009 at 4:08 PM, Nils Kilden-Pedersen <nilskp [at] gmail [dot] com> wrote:
On Fri, Oct 2, 2009 at 10:20 AM, Viktor Klang <viktor [dot] klang [at] gmail [dot] com> wrote:
it would be a great step forward to have as a goal to have unlimited precision integers and decimals (and do away with the others/invisiboxing) planned for something like Scala 3.0

Several people have now called BigDecimal "unlimited". That is nonsensical. It is of arbitrary, and limited, precision, just like float and double. And it would be impossible, and useless even, to come up with anything that has "unlimited" precision.

I still find BigDecimal an annoying name, considering that there won't ever be a Decimal class, but thanks to Scala (Martin really), I can just rename it myself.



--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq


On Fri, Oct 2, 2009 at 9:08 PM, Nils Kilden-Pedersen <nilskp [at] gmail [dot] com> wrote:
On Fri, Oct 2, 2009 at 10:20 AM, Viktor Klang <viktor [dot] klang [at] gmail [dot] com> wrote:
it would be a great step forward to have as a goal to have unlimited precision integers and decimals (and do away with the others/invisiboxing) planned for something like Scala 3.0

Several people have now called BigDecimal "unlimited". That is nonsensical. It is of arbitrary, and limited, precision, just like float and double. And it would be impossible, and useless even, to come up with anything that has "unlimited" precision.

Nils, nowhere did I say that BigDecimal was unlimited.

I was imagining a stucture where correctness was more valued than speed, and numbers could be viewed as a Stream[Digit] and desired precision was up to the consumer of the number.

I still find BigDecimal an annoying name, considering that there won't ever be a Decimal class, but thanks to Scala (Martin really), I can just rename it myself.



--
Viktor Klang

Blog: klangism.blogspot.com
Twttr: viktorklang

Lift Committer - liftweb.com
AKKA Committer - akkasource.org
Cassidy - github.com/viktorklang/Cassidy.git
SoftPub founder: http://groups.google.com/group/softpub
Jesper Nordenberg
Joined: 2008-12-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Sequence -> Seq

Nils Kilden-Pedersen wrote:
> Several people have now called BigDecimal "unlimited". That is
> nonsensical. It is of arbitrary, and limited, precision, just like float
> and double. And it would be impossible, and useless even, to come up
> with anything that has "unlimited" precision.

Of course there is a physical limit to the precision, like available
disk space and memory. But one could certainly create a number class
which precision is only limited by these physical restrictions, and not
by the actual implementation. I don't know if this is the case with
BigDecimal, but I can definitely see the value of such an implementation.

/Jesper Nordenberg

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: Sequence -> Seq
On Fri, Oct 2, 2009 at 6:19 PM, Jesper Nordenberg <megagurka [at] yahoo [dot] com> wrote:
Of course there is a physical limit to the precision, like available disk space and memory. But one could certainly create a number class which precision is only limited by these physical restrictions, and not by the actual implementation. I don't know if this is the case with BigDecimal, but I can definitely see the value of such an implementation.

Really? I can't think of any.

Randall R Schulz
Joined: 2008-12-16,
User offline. Last seen 1 year 29 weeks ago.
Re: Re: Sequence -> Seq

On Friday October 2 2009, Nils Kilden-Pedersen wrote:
> On Fri, Oct 2, 2009 at 6:19 PM, wrote:
> > Of course there is a physical limit to the precision, like
> > available disk space and memory. But one could certainly create a
> > number class which precision is only limited by these physical
> > restrictions, and not by the actual implementation. I don't know if
> > this is the case with BigDecimal, but I can definitely see the
> > value of such an implementation.
>
> Really? I can't think of any.

How about computing with the numbers your application encounters or
generates regardless of their magnitude? Many languages have
arbitrary-precision numeric packages.

lists 28
arbitary-precision numeric packages and 12 languages that support
arbitrary-precision numbers either directly or via their standard
library.

Both of Java's BigInteger and BigDecimal have arbitary precision.

Randall Schulz

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Re: Sequence -> Seq
Really? Do you think it makes any sense to _check_ for overflow, to care whether an Int is enough or you'll have to use a Long or even a Float or Double?
Worse yet, do you realize such overflows are mostly _silent_?
Sure, there are many applications where performance is critical, but by far most uses of numbers in todays applications are not performance-critical.
To put it more simply, it makes no more sense in these day to make manual number-size management the default than it makes sense to make manual memory management the default. You are just introducing unnecessary complexity and fail modes.

On Fri, Oct 2, 2009 at 8:36 PM, Nils Kilden-Pedersen <nilskp [at] gmail [dot] com> wrote:
On Fri, Oct 2, 2009 at 6:19 PM, Jesper Nordenberg <megagurka [at] yahoo [dot] com> wrote:
Of course there is a physical limit to the precision, like available disk space and memory. But one could certainly create a number class which precision is only limited by these physical restrictions, and not by the actual implementation. I don't know if this is the case with BigDecimal, but I can definitely see the value of such an implementation.

Really? I can't think of any.




--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: Sequence -> Seq
On Fri, Oct 2, 2009 at 7:29 PM, Daniel Sobral <dcsobral [at] gmail [dot] com> wrote:
Really? Do you think it makes any sense to _check_ for overflow, to care whether an Int is enough or you'll have to use a Long or even a Float or Double?

Daniel and Randall, I thought it was pretty clear that I was referring to unlimited precision, not the arbitrary, but non-overflowing precision of BigDecimal, which of course is useful.
Jesper Nordenberg
Joined: 2008-12-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Sequence -> Seq

Nils Kilden-Pedersen wrote:
> Daniel and Randall, I thought it was pretty clear that I was referring
> to unlimited precision, not the arbitrary, but non-overflowing precision
> of BigDecimal, which of course is useful.

What's the difference between unlimited and arbitrary precision? Looking
at the source code for BigInteger and BigDecimal, they are limited by
both the value range of int and the maximum size of an array, so I don't
see how they can have arbitrary nor unlimited precision.

/Jesper Nordenberg

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: Sequence -> Seq
On Sat, Oct 3, 2009 at 3:28 AM, Jesper Nordenberg <megagurka [at] yahoo [dot] com> wrote:
What's the difference between unlimited and arbitrary precision?

Maybe we're just mincing words, but I would expect something of unlimited precision to be able to represent all real numbers, or at the very least the rational ones. BigDecimal does neither (and shouldn't be expected to). That's what makes its precision arbitrary.

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Re: Sequence -> Seq

As long as programmers do not expect their machine to grab all the
atoms in the universe if needed to represent a number, I think it's
perfectly reasonable to call an arbitrary precision numeric type
unlimited.

2009/10/4 Nils Kilden-Pedersen :
> On Sat, Oct 3, 2009 at 3:28 AM, Jesper Nordenberg
> wrote:
>>
>> What's the difference between unlimited and arbitrary precision?
>
> Maybe we're just mincing words, but I would expect something of unlimited
> precision to be able to represent all real numbers, or at the very least the
> rational ones. BigDecimal does neither (and shouldn't be expected to).
> That's what makes its precision arbitrary.
>
>

marius
Joined: 2008-08-31,
User offline. Last seen 3 years 19 weeks ago.
Re: Re: Sequence -> Seq
+1 !!!

On Thu, Oct 1, 2009 at 1:03 PM, martin odersky <martin [dot] odersky [at] epfl [dot] ch> wrote:
I believe the discussion was sufficiently controversal that no clear
case for Seq over Sequence or the other way round emerged. In that
case, I think the principle of least change should win, and we'll
leave it at Seq. OK for everyone?

Cheers

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland