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

Sequence -> Seq

72 replies
stepancheg
Joined: 2009-01-12,
User offline. Last seen 3 years 32 weeks ago.

Hi.

Shouldn't Sequence be renamed to Seq until it is too late?

Seq is used very frequently (at least in my code), and "Sequence" is
too long word. I've counted symbols in my mysql-diff program using the
script:

find . -name '*.scala' | xargs cat | awk '{ split($0, a, "[
.(){},:!=+~<>\\[\\]-]"); for (x in a) { print a[x]; } }' | egrep
'^[A-Z]' | sort | uniq -c | sort -n

Most frequently used scala library classes are:

445 String
300 Seq <-- it is
198 Some
142 None
95 List
89 Option
45 ArrayBuffer <-- that's why I think ArrayBuffer should be aliased in Predef
36 Int
34 Any
28 Boolean

and method "toSequence" should be renamed to "toSeq".

My 2 cents.

S.

odd
Joined: 2009-04-07,
User offline. Last seen 26 weeks 4 days ago.
RE: Sequence -> Seq

I disagree. While I can understand the strive to have short and easily writable names, I believe the added clarity is well worth the extra characters in this case.
Now let's see what can be done about Int...

Greetings
Odd Möller

-----Original Message-----
From: stepancheg [at] mx1 [dot] ru [mailto:stepancheg [at] mx1 [dot] ru] On Behalf Of Stepan Koltsov
Sent: Tuesday, September 22, 2009 6:39 PM
To: scala-debate
Subject: [scala-debate] Sequence -> Seq

Hi.

Shouldn't Sequence be renamed to Seq until it is too late?

Seq is used very frequently (at least in my code), and "Sequence" is
too long word. I've counted symbols in my mysql-diff program using the
script:

find . -name '*.scala' | xargs cat | awk '{ split($0, a, "[
.(){},:!=+~<>\\[\\]-]"); for (x in a) { print a[x]; } }' | egrep
'^[A-Z]' | sort | uniq -c | sort -n

Most frequently used scala library classes are:

445 String
300 Seq <-- it is
198 Some
142 None
95 List
89 Option
45 ArrayBuffer <-- that's why I think ArrayBuffer should be aliased in Predef
36 Int
34 Any
28 Boolean

and method "toSequence" should be renamed to "toSeq".

My 2 cents.

S.

stepancheg
Joined: 2009-01-12,
User offline. Last seen 3 years 32 weeks ago.
Re: Sequence -> Seq

On Tue, Sep 22, 2009 at 21:59, Odd Möller wrote:
> I disagree. While I can understand the strive to have short and easily writable names, I believe the added clarity is well worth the extra characters in this case.

Seq is an obvious shortening for Sequence, there is no big loss of
clarity, like there no one in Predef for Predefined, Elem for Element
and io.Source for io.SourceOfCharacters.

> Now let's see what can be done about Int...

Int is a good example of what is done properly: Integer shortened to Int.

S.

> Greetings
> Odd Möller
>
> -----Original Message-----
> From: stepancheg [at] mx1 [dot] ru [mailto:stepancheg [at] mx1 [dot] ru] On Behalf Of Stepan Koltsov
> Sent: Tuesday, September 22, 2009 6:39 PM
> To: scala-debate
> Subject: [scala-debate] Sequence -> Seq
>
> Hi.
>
> Shouldn't Sequence be renamed to Seq until it is too late?
>
> Seq is used very frequently (at least in my code), and "Sequence" is
> too long word. I've counted symbols in my mysql-diff program using the
> script:
>
> find . -name '*.scala' | xargs cat | awk '{ split($0, a, "[
> .(){},:!=+~<>\\[\\]-]"); for (x in a) { print a[x]; } }' | egrep
> '^[A-Z]' | sort | uniq -c | sort -n
>
> Most frequently used scala library classes are:
>
> 445 String
> 300 Seq  <-- it is
> 198 Some
> 142 None
> 95 List
> 89 Option
> 45 ArrayBuffer <-- that's why I think ArrayBuffer should be aliased in Predef
> 36 Int
> 34 Any
> 28 Boolean
>
> and method "toSequence" should be renamed to "toSeq".
>
> My 2 cents.
>
> S.
>

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Sequence -> Seq

Stepan Koltsov mx1.ru> writes:
> Shouldn't Sequence be renamed to Seq until it is too late?

For whatever it's worth, I like Seq better too.

Best,
Ismael

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 48 min ago.
Re: Re: Sequence -> Seq

On Tuesday 22 September 2009 22:15:35 Ismael Juma wrote:
> Stepan Koltsov mx1.ru> writes:
> > Shouldn't Sequence be renamed to Seq until it is too late?
>
> For whatever it's worth, I like Seq better too.
>
> Best,
> Ismael
>

Am next here!

(as well toSeq instead of toSequence; Bool is also better rather Boolean, but
at this case it is too late to deprecate, probably)

Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
Re: Re: Sequence -> Seq
+1

On Tue, Sep 22, 2009 at 2:15 PM, Ismael Juma <mlists [at] juma [dot] me [dot] uk> wrote:
Stepan Koltsov <yozh <at> mx1.ru> writes:
> Shouldn't Sequence be renamed to Seq until it is too late?

For whatever it's worth, I like Seq better too.

Best,
Ismael




--
http://erikengbrecht.blogspot.com/
Seth Tisue
Joined: 2008-12-16,
User offline. Last seen 34 weeks 3 days ago.
Re: Re: Sequence -> Seq

>>>>> "Ismael" == Ismael Juma writes:

>> Shouldn't Sequence be renamed to Seq until it is too late?

Ismael> For whatever it's worth, I like Seq better too.

Me too. (I've been baffled by the change ever since it happened.)

Stepan Koltsov 2
Joined: 2009-01-21,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Sequence -> Seq

On Tue, Sep 22, 2009 at 22:28, Seth Tisue wrote:
>>>>>> "Ismael" == Ismael Juma writes:
>
>  >> Shouldn't Sequence be renamed to Seq until it is too late?
>
>  Ismael> For whatever it's worth, I like Seq better too.
>
> Me too.  (I've been baffled by the change ever since it happened.)

Well, it is not a big change. Seq alias still exists in "scala"
package. But the real class name is Sequence.

However Iterable.toSeq method is deprecated in favor of toSequence.

S.

David Pollak
Joined: 2008-12-16,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Sequence -> Seq


On Tue, Sep 22, 2009 at 11:15 AM, Ismael Juma <mlists [at] juma [dot] me [dot] uk> wrote:
Stepan Koltsov <yozh <at> mx1.ru> writes:
> Shouldn't Sequence be renamed to Seq until it is too late?

For whatever it's worth, I like Seq better too.

+1
 

Best,
Ismael




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp
Randall R Schulz
Joined: 2008-12-16,
User offline. Last seen 1 year 29 weeks ago.
Re: Sequence -> Seq

On Tuesday September 22 2009, Stepan Koltsov wrote:
> Hi.
>
> Shouldn't Sequence be renamed to Seq until it is too late?

And now for something completely different!

Nah. I prefer Seq.

RRS

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq
On Tue, Sep 22, 2009 at 1:11 PM, Stepan Koltsov <yozh [at] mx1 [dot] ru> wrote:
Int is a good example of what is done properly: Integer shortened to Int.

Agreed. Now if we could only rename BigDecimal to just Decimal...
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Sequence -> Seq

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?

Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
Re: Sequence -> Seq
+5 to that...the BigX class names are just annoying...

On Tue, Sep 22, 2009 at 3:17 PM, Nils Kilden-Pedersen <nilskp [at] gmail [dot] com> wrote:
On Tue, Sep 22, 2009 at 1:11 PM, Stepan Koltsov <yozh [at] mx1 [dot] ru> wrote:
Int is a good example of what is done properly: Integer shortened to Int.

Agreed. Now if we could only rename BigDecimal to just Decimal...



--
http://erikengbrecht.blogspot.com/
Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
Re: Sequence -> Seq
Can we change BigInt to Integer, too?

On Tue, Sep 22, 2009 at 3: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?

--
Paul Phillips      | The important thing here is that the music is not in
Everyman           | the piano.  And knowledge and edification is not in the
Empiricist         | computer.  The computer is simply an instrument whose
ha! spill, pupil   | music is ideas.  -- Alan Kay



--
http://erikengbrecht.blogspot.com/
loverdos
Joined: 2008-11-18,
User offline. Last seen 2 years 27 weeks ago.
Re: Sequence -> Seq

On Sep 22, 2009, at 19:39, Stepan Koltsov wrote:

> Hi.
>
> Shouldn't Sequence be renamed to Seq until it is too late?

+1

>
> Seq is used very frequently (at least in my code), and "Sequence" is
> too long word. I've counted symbols in my mysql-diff program using the
> script:
>
> find . -name '*.scala' | xargs cat | awk '{ split($0, a, "[
> .(){},:!=+~<>\\[\\]-]"); for (x in a) { print a[x]; } }' | egrep
> '^[A-Z]' | sort | uniq -c | sort -n
>
Now, this is a nice script! I ran it on trunk/src and got

3232 A <-- must be type parameter
1138 T <-- ditto
886 B
663 String
549 List
524 Symbol
488 Int
463 Tree
349 Char
325 Type
300 T1
...
3 Xms16M
3 Xmx512M
...

> Most frequently used scala library classes are:
>
> 445 String
> 300 Seq <-- it is
> 198 Some
> 142 None
> 95 List
> 89 Option
> 45 ArrayBuffer <-- that's why I think ArrayBuffer should be aliased
> in Predef
> 36 Int
> 34 Any
> 28 Boolean
>
> and method "toSequence" should be renamed to "toSeq".
>
> My 2 cents.
>
> S.

Tony Morris 2
Joined: 2009-03-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Sequence -> Seq

Me too, but mostly because we use Sequence for a finger-tree backed list
(with better effiiciency of operations).

Erik Engbrecht wrote:
> +1
>
> On Tue, Sep 22, 2009 at 2:15 PM, Ismael Juma > wrote:
>
> Stepan Koltsov mx1.ru > writes:
> > Shouldn't Sequence be renamed to Seq until it is too late?
>
> For whatever it's worth, I like Seq better too.
>
> Best,
> Ismael
>
>
>
>

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: Sequence -> Seq
Could we also make  "BestDecimal".... That way I know which one is the best one to use....

On Tue, Sep 22, 2009 at 3: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?

--
Paul Phillips      | The important thing here is that the music is not in
Everyman           | the piano.  And knowledge and edification is not in the
Empiricist         | computer.  The computer is simply an instrument whose
ha! spill, pupil   | music is ideas.  -- Alan Kay

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Sequence -> Seq

Josh Suereth gmail.com> writes:
> Could we also make  "BestDecimal".... That way I know which one is the
> best one to use....

If only we had such a thing in the JVM...

Ismael

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

Well, we have Traversable, Iterable, Sequence, Vector in the
hierarchy. We should we shorten Sequence to Seq and not also Iterable
to Itble, say? The only reason I would accept is because that's what
we did before. But then that means that all the other renaming
requests would also have to be rejected, for the same reason.

Cheers

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Sequence -> Seq
Just fix the IDEs so we can have auto-completion.

On Tue, Sep 22, 2009 at 1:39 PM, Stepan Koltsov <yozh [at] mx1 [dot] ru> wrote:
Hi.

Shouldn't Sequence be renamed to Seq until it is too late?

Seq is used very frequently (at least in my code), and "Sequence" is
too long word. I've counted symbols in my mysql-diff program using the
script:

find . -name '*.scala' | xargs cat | awk '{ split($0, a, "[
.(){},:!=+~<>\\[\\]-]"); for (x in a) { print a[x]; } }' | egrep
'^[A-Z]' | sort | uniq -c | sort -n

Most frequently used scala library classes are:

445 String
300 Seq  <-- it is
198 Some
142 None
95 List
89 Option
45 ArrayBuffer <-- that's why I think ArrayBuffer should be aliased in Predef
36 Int
34 Any
28 Boolean

and method "toSequence" should be renamed to "toSeq".

My 2 cents.

S.



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

On Tuesday September 22 2009, Daniel Sobral wrote:
> Just fix the IDEs so we can have auto-completion.

It works fine in IDEA.

RRS

Stepan Koltsov 2
Joined: 2009-01-21,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Sequence -> Seq

On Wed, Sep 23, 2009 at 01:23, martin odersky wrote:
> Well, we have Traversable, Iterable, Sequence, Vector in the
> hierarchy. We should we shorten Sequence to Seq and not also Iterable
> to Itble, say? The only reason I would accept is because that's what
> we did before. But then that means that all the other renaming
> requests would also have to be rejected, for the same reason.

Because Iterable is not used as much as Sequence, and because Itble is
ugly, unlike Seq.

I have no other requests.

S.

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

On Wed, Sep 23, 2009 at 02:42, Randall R Schulz wrote:
> On Tuesday September 22 2009, Daniel Sobral wrote:
>> Just fix the IDEs so we can have auto-completion.
>
> It works fine in IDEA.

One of the biggest advantages of Scala over Java is an ability to code
programs in Vim.

"Just fix something" is an universal answer to
any complaint.

S.

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

On Tuesday September 22 2009, Stepan Koltsov wrote:
> On Wed, Sep 23, 2009 at 02:42, Randall R Schulz wrote:
> > On Tuesday September 22 2009, Daniel Sobral wrote:
> >> Just fix the IDEs so we can have auto-completion.
> >
> > It works fine in IDEA.
>
> One of the biggest advantages of Scala over Java is an ability to
> code programs in Vim.

I'm afraid I don't see the relationship or correlation going in that
direction. Why do you think Vim is more suitable for Scala than Java?

For me, Vim's Scala mode is pretty annoying. For one thing, it keeps
taking away my tabs, and I require tabs to be preserved
("gg!Gunexpand -4"). It also appears to have a hard-coded
indent, which is at odds with my preference.

I can control these things in IDEA as well as get the advantage of its
language-aware program indexing and cross-referencing and other
productivity enhancing features (even though its Scala plug-in is still
rather meager).

> ...
>
> S.

Randall Schulz

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

On Wed, Sep 23, 2009 at 04:18, Randall R Schulz wrote:
> On Tuesday September 22 2009, Stepan Koltsov wrote:
>> On Wed, Sep 23, 2009 at 02:42, Randall R Schulz wrote:
>> > On Tuesday September 22 2009, Daniel Sobral wrote:
>> >> Just fix the IDEs so we can have auto-completion.
>> >
>> > It works fine in IDEA.
>>
>> One of the biggest advantages of Scala over Java is an ability to
>> code programs in Vim.
>
> I'm afraid I don't see the relationship or correlation going in that
> direction. Why do you think Vim is more suitable for Scala than Java?

Because Scala requires much less symbols to type and much less to keep
in mind, then Java to code the same logic.

> For me, Vim's Scala mode is pretty annoying. For one thing, it keeps
> taking away my tabs, and I require tabs to be preserved
> ("gg!Gunexpand -4"). It also appears to have a hard-coded
> indent, which is at odds with my preference.

I use only Vim Scala syntax hilghighter.

S.

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

On Tuesday September 22 2009, Stepan Koltsov wrote:
> On Wed, Sep 23, 2009 at 04:18, Randall R Schulz wrote:
> > On Tuesday September 22 2009, Stepan Koltsov wrote:
> >> On Wed, Sep 23, 2009 at 02:42, Randall R Schulz wrote:
> >> > On Tuesday September 22 2009, Daniel Sobral wrote:
> >> >> Just fix the IDEs so we can have auto-completion.
> >> >
> >> > It works fine in IDEA.
> >>
> >> One of the biggest advantages of Scala over Java is an ability to
> >> code programs in Vim.
> >
> > I'm afraid I don't see the relationship or correlation going in
> > that direction. Why do you think Vim is more suitable for Scala
> > than Java?
>
> Because Scala requires much less symbols to type and much less to
> keep in mind, then Java to code the same logic.

Oh, really? Less typing, sure. Less to hold in your mind? I don't really
believe that's so.

> > For me, Vim's Scala mode is pretty annoying. For one thing, it
> > keeps taking away my tabs, and I require tabs to be preserved
> > ("gg!Gunexpand -4"). It also appears to have a hard-coded
> > indent, which is at odds with my preference.
>
> I use only Vim Scala syntax hilghighter.

How do you keep it from imposing its formatting on you?

> S.

Randall Schulz

Stepan Koltsov 2
Joined: 2009-01-21,
User offline. Last seen 42 years 45 weeks ago.
Re: Sequence -> Seq

On Wed, Sep 23, 2009 at 04:29, Randall R Schulz wrote:
> On Tuesday September 22 2009, Stepan Koltsov wrote:
>> On Wed, Sep 23, 2009 at 04:18, Randall R Schulz wrote:
>> > On Tuesday September 22 2009, Stepan Koltsov wrote:
>> >> On Wed, Sep 23, 2009 at 02:42, Randall R Schulz wrote:
>> >> > On Tuesday September 22 2009, Daniel Sobral wrote:
>> >> >> Just fix the IDEs so we can have auto-completion.
>> >> >
>> >> > It works fine in IDEA.
>> >>
>> >> One of the biggest advantages of Scala over Java is an ability to
>> >> code programs in Vim.
>> >
>> > I'm afraid I don't see the relationship or correlation going in
>> > that direction. Why do you think Vim is more suitable for Scala
>> > than Java?
>>
>> Because Scala requires much less symbols to type and much less to
>> keep in mind, then Java to code the same logic.
>
> Oh, really? Less typing, sure. Less to hold in your mind? I don't really
> believe that's so.

===
def findUserIds =
findUsers.map(_.id)
===

I don't have to remeber neither user class name, nor "id" field type.

>> > For me, Vim's Scala mode is pretty annoying. For one thing, it
>> > keeps taking away my tabs, and I require tabs to be preserved
>> > ("gg!Gunexpand -4"). It also appears to have a hard-coded
>> > indent, which is at odds with my preference.
>>
>> I use only Vim Scala syntax hilghighter.
>
> How do you keep it from imposing its formatting on you?

I does not format anything. Probably, it is because of plugin, that my
friend has written for me years ago:

http://gist.github.com/191618

S.

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

On Tuesday September 22 2009, Stepan Koltsov wrote:
> On Wed, Sep 23, 2009 at 04:29, Randall R Schulz wrote:
> > On Tuesday September 22 2009, Stepan Koltsov wrote:
> >> On Wed, Sep 23, 2009 at 04:18, Randall R Schulz wrote:
> >> > On Tuesday September 22 2009, Stepan Koltsov wrote:
> >> >>
> >> >> One of the biggest advantages of Scala over Java is an ability
> >> >> to code programs in Vim.
> >> >
> >> > I'm afraid I don't see the relationship or correlation going in
> >> > that direction. Why do you think Vim is more suitable for Scala
> >> > than Java?
> >>
> >> Because Scala requires much less symbols to type and much less to
> >> keep in mind, then Java to code the same logic.
> >
> > Oh, really? Less typing, sure. Less to hold in your mind? I don't
> > really believe that's so.
>
> ===
> def findUserIds =
> findUsers.map(_.id)
> ===
>
> I don't have to remeber neither user class name, nor "id" field type.

I have not idea what that's supposed to illustrate, but I don't think
programming-in-the-small is where the issues lie.

> ...
>
> S.

Randall Schulz

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

I believe character counting is not the best way to design an API.
There are two arguments for Sequence in place of seq: Consistency and
separation. Consistency: All collection classes except Seq use their
full names. Separation: With the soon to be expected arrival of
parallel collections, we want `seq' and `par' (in lower case) mean
sequential, respectively parallel. So on a parallel collection pxs,
you'll be able to write

pxs.seq.map(f)

This means you want the map to be applied sequentially, not in
parallel. There's no naming conflict per se, because Seq is
capitalized but seq is not, but the two are uncomfortably close, IMO.

In my mind, the only valid reason to keep Seq is backwards
compatibility. But Seq is still present in 2.8, it's just deprecated.
So all that's demanded is that at some point in the future of their
choosing users do a global search and replace from Seq to Sequence. I
thought this is an acceptable demand. If people strongly agree, please
speak up!

Cheers

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Sequence -> Seq

Hi Martin,

martin odersky epfl.ch> writes:
> I believe character counting is not the best way to design an API.

Definitely not. But short, descriptive and unambiguous names for commonly-used
classes and methods make for more readable code. Personally, I have 0 concern
for the extra typing, it's the readability that I am interested in. In effect,
Seq("foo", "bar", "baz") is our Seq literal syntax and I, for one, use that a
lot in 2.7.x (more than List("foo", "bar", "baz")). The extra characters
introduced by Sequence just take more space that could be used by the
interesting part, the arguments.

> There are two arguments for Sequence in place of seq: Consistency and
> separation. Consistency: All collection classes except Seq use their
> full names. Separation: With the soon to be expected arrival of
> parallel collections, we want `seq' and `par' (in lower case) mean
> sequential, respectively parallel. So on a parallel collection pxs,
> you'll be able to write
>
> pxs.seq.map(f)

I find this interesting. Why is abbreviation OK here? Shall we be prepared for a
change to pxs.sequentially.map(f) in the future?

> In my mind, the only valid reason to keep Seq is backwards
> compatibility. But Seq is still present in 2.8, it's just deprecated.
> So all that's demanded is that at some point in the future of their
> choosing users do a global search and replace from Seq to Sequence. I
> thought this is an acceptable demand. If people strongly agree, please
> speak up!

I find that it's extra effort for the users for no or little gain (at best). In
the end, however, it's just an annoyance (both the longer name and the forced
migration). There are certainly issues of higher priority in Scala-land.

Best,
Ismael

Seth Tisue
Joined: 2008-12-16,
User offline. Last seen 34 weeks 3 days ago.
Re: Sequence -> Seq

>>>>> "martin" == martin odersky writes:

martin> But Seq is still present in 2.8, it's just deprecated.

At present on trunk, toSeq is deprecated, but Seq itself isn't.
I guess that's an oversight?

~> scala28 -deprecation
Welcome to Scala version 2.8.0.r18678-b20090910020815 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_15).
Type in expressions to have them evaluated.
Type :help for more information.

scala> List(1).toSeq
:5: warning: method toSeq in trait IterableTemplate is deprecated: use `toSequence' instead
List(1).toSeq
^
res0: Sequence[Int] = List(1)

scala> Seq(1, 2, 3)
res1: Sequence[Int] = List(1, 2, 3)

Vladimir Kirichenko
Joined: 2009-02-19,
User offline. Last seen 42 years 45 weeks ago.
Re: Sequence -> Seq

On Wed, Sep 23, 2009 at 10:17 AM, martin odersky wrote:
> I believe character counting is not the best way to design an API.

+1

> If people strongly agree, please
> speak up!

+1

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

I was going to agree heavily with keeping "Seq", though it’s difficult
to judge without having done any 2.8 programming.

The main decider for me would be: is Seq[uence] going to be written,
more than Iterable or Traversable? I find myself using Seq (in Scala
2.6) rather a lot, and its short name befits a) the frequency of its
use and b) the specificity of its purpose.

(As Ismael said, the side discussion about tab-completion and IDE
support is irrelevant. I don’t care about having to type 5 more
characters; my concern is that "Seq(1, 2, 3, 4, 5)" is visually
cleaner than "Sequence(1, 2, 3, 4, 5)". Likewise, a one-off search-
replace of "Seq" for "Sequence" is not a problem (for me). I would be
disappointed if it ended up making my code looking a little more
unwieldy though.)

–Andrew

On 23 Sep 2009, at 09:28, Ismael Juma wrote:

> Hi Martin,
>
> martin odersky epfl.ch> writes:
>> I believe character counting is not the best way to design an API.
>
> Definitely not. But short, descriptive and unambiguous names for
> commonly-used
> classes and methods make for more readable code. Personally, I have
> 0 concern
> for the extra typing, it's the readability that I am interested in.
> In effect,
> Seq("foo", "bar", "baz") is our Seq literal syntax and I, for one,
> use that a
> lot in 2.7.x (more than List("foo", "bar", "baz")). The extra
> characters
> introduced by Sequence just take more space that could be used by the
> interesting part, the arguments.
>
>> There are two arguments for Sequence in place of seq: Consistency and
>> separation. Consistency: All collection classes except Seq use their
>> full names. Separation: With the soon to be expected arrival of
>> parallel collections, we want `seq' and `par' (in lower case) mean
>> sequential, respectively parallel. So on a parallel collection pxs,
>> you'll be able to write
>>
>> pxs.seq.map(f)
>
> I find this interesting. Why is abbreviation OK here? Shall we be
> prepared for a
> change to pxs.sequentially.map(f) in the future?
>
>> In my mind, the only valid reason to keep Seq is backwards
>> compatibility. But Seq is still present in 2.8, it's just deprecated.
>> So all that's demanded is that at some point in the future of their
>> choosing users do a global search and replace from Seq to Sequence. I
>> thought this is an acceptable demand. If people strongly agree,
>> please
>> speak up!
>
> I find that it's extra effort for the users for no or little gain
> (at best). In
> the end, however, it's just an annoyance (both the longer name and
> the forced
> migration). There are certainly issues of higher priority in Scala-
> land.
>
> Best,
> Ismael
>

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

On Wednesday September 23 2009, Andrew Forrest wrote:
> I was going to agree heavily with keeping "Seq", though it’s
> difficult to judge without having done any 2.8 programming.
>
> The main decider for me would be: is Seq[uence] going to be written,
> more than Iterable or Traversable? I find myself using Seq (in Scala
> 2.6) rather a lot, and its short name befits a) the frequency of its
> use and b) the specificity of its purpose.

Along these lines, I think it's more meaningful to look at words in
natural languages and symbols in compression coding system.
Specifically, the more used, the shorter.

I don't think pure consistency is the only rule or even the most
important factor. Nor do I think freedom from ambiguity of the term
itself is very important, especially since we're using natural language
(English) words or multiples thereof to name our library types.
(Consider our use of "map" both in its verb and noun senses.) I think
convenience for the intended user is the primary metric. Of course,
defining convenience is difficult, non-objective and usually
contentious.

> (As Ismael said, the side discussion about tab-completion and IDE
> support is irrelevant. I don’t care about having to type 5 more
> characters; my concern is that "Seq(1, 2, 3, 4, 5)" is visually
> cleaner than "Sequence(1, 2, 3, 4, 5)". Likewise, a one-off search-
> replace of "Seq" for "Sequence" is not a problem (for me). I would be
> disappointed if it ended up making my code looking a little more
> unwieldy though.)

Auto-completion is not high on my list of editor / IDE virtues, either.

One other thing to consider is potential interference between library
names and names that programmers would like to use for their own
purposes. Naturally, the nature of naming in Scala precludes any
unavoidable conflicts, except for keywords (you can always use more
qualified names or create aliases), but still, aliasing adds to the
cognitive burden. From this perspective, the fact that user-defined
(non-library) types are usually more specific and of narrower
applicability, it's reasonable for them to have the longer names and
for common, shared, general-purpose (library) types of wider
applicability to have more concise names.

Lastly, note that the term used for sequential collections gets combined
with other names, which also argues for the shorter name.

Finally:

List
Map
Seq
Set

vs.

List
Map
Sequence
Set

I still prefer keeping it Seq.

> –Andrew

Randall Schulz

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Sequence -> Seq
On the contrary. "Just fix something" means dealing with the problem in the correct way, instead of hacking shortgap solutions.   We have different drives here:   1) Readability: long, descriptive names instead of a sea of abbreviations. 2) Consistency: avoid exceptions. 3) Ease of writing: keep character count low.   Going from Seq to Sequence increases 2 (by making it respect 1) and decreases 3.   Most code is read more times than written, so goals 1 and 2 take precedence over goal 3. The solution to achieving goal 3 without giving up on 1 and 2, is to use auto-completion. Now, given the present state of Scala support on IDE, people have been avoiding them, so this becomes more of a bother. So, fixing it is a good solution.   "Keep Sequence instead of Seq so that I can use Vim" doesn't cut it with me as laudable goal.   "Just fix IDE so most people won't be bothered by the problem" does maximize the benefits.   And if it bothers you too much, add this to the top of the file:   import scala.collection.{Sequence=>Seq}     For the record, I'm against keeping Seq. And I _would_ prefer "makeString" over "mkString". Languages over-fond or abbreviations are fine as long as the library is small. That's not Scala -- in fact, having rich APIs is one of the given reasons for traits. On a language with a huge library, abbreviations are taxing.

On Tue, Sep 22, 2009 at 8:58 PM, Stepan Koltsov <stepan [dot] koltsov [at] gmail [dot] com> wrote:
On Wed, Sep 23, 2009 at 02:42, Randall R Schulz <rschulz [at] sonic [dot] net> wrote:
> On Tuesday September 22 2009, Daniel Sobral wrote:
>> Just fix the IDEs so we can have auto-completion.
>
> It works fine in IDEA.

One of the biggest advantages of Scala over Java is an ability to code
programs in Vim.

"Just fix something" is an universal <censored-adjective> answer to
any complaint.

S.



--
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.
imaier
Joined: 2008-07-01,
User offline. Last seen 23 weeks 2 days ago.
Re: Re: Sequence -> Seq

On 9/23/09 4:24 PM, Randall R Schulz wrote:
> On Wednesday September 23 2009, Andrew Forrest wrote:
>> I was going to agree heavily with keeping "Seq", though it’s
>> difficult to judge without having done any 2.8 programming.
>>
>> The main decider for me would be: is Seq[uence] going to be written,
>> more than Iterable or Traversable? I find myself using Seq (in Scala
>> 2.6) rather a lot, and its short name befits a) the frequency of its
>> use and b) the specificity of its purpose.
>
> Along these lines, I think it's more meaningful to look at words in
> natural languages and symbols in compression coding system.
> Specifically, the more used, the shorter.

That's not how Scala evolved. In the beginning, there was Seq. Then,
people started using it. So one could also ask whether Seq is being used
so often *because* it's so short: "I don't quite know what kind of
collection I want, so let's take Seq. It's easy to type."

>
> Finally:
>
> List
> Map
> Seq
> Set
>
> vs.
>
> List
> Map
> Sequence
> Set

What about Buffer, Vector, Iterable?

Ingo

>
>
> I still prefer keeping it Seq.
>
>
>> –Andrew
>
>
> Randall Schulz
>

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Re: Sequence -> Seq

On Wed, Sep 23, 2009 at 07:24:16AM -0700, Randall R Schulz wrote:
> Map
> Seq
> Set

As long as we're voting here, I find this depiction very compelling. I
strongly prefer Seq anyway so I don't mean to imply that convinced a
fence sitter, but those are the Big Three Collections and there is an
elegant (and utterly unambiguous) uniformity. Somehow we've made it
this far with "Map" and "map" both in constant use, so I'm not sure why
"Seq" and "seq" presents any more of an issue.

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 48 min ago.
Re: Sequence -> Seq

On Wednesday 23 September 2009 18:42:05 Daniel Sobral wrote:
> On the contrary. "Just fix something" means dealing with the problem in the
> correct way, instead of hacking shortgap solutions.
>
> We have different drives here:
>
> 1) Readability: long, descriptive names instead of a sea of abbreviations.

It's a matter of taste. For my eyes "long, descriptive names" sometimes hide a
code sense. And I agree - a code must be readable at first place, and only
then do something useful (and, probably, rapid) :-)

Stepan Koltsov 2
Joined: 2009-01-21,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Sequence -> Seq

On Wed, Sep 23, 2009 at 18:46, Ingo Maier wrote:
> On 9/23/09 4:24 PM, Randall R Schulz wrote:
>>
>> On Wednesday September 23 2009, Andrew Forrest wrote:
>>>
>>> I was going to agree heavily with keeping "Seq", though it’s
>>> difficult to judge without having done any 2.8 programming.
>>>
>>> The main decider for me would be: is Seq[uence] going to be written,
>>> more than Iterable or Traversable? I find myself using Seq (in Scala
>>> 2.6) rather a lot, and its short name befits a) the frequency of its
>>> use and b) the specificity of its purpose.
>>
>> Along these lines, I think it's more meaningful to look at words in
>> natural languages and symbols in compression coding system.
>> Specifically, the more used, the shorter.
>
> That's not how Scala evolved. In the beginning, there was Seq. Then, people
> started using it. So one could also ask whether Seq is being used so often
> *because* it's so short: "I don't quite know what kind of collection I want,
> so let's take Seq. It's easy to type."

When people don't understand what are they doing, they use List.

Seq is equivalent of java.util.List, or python builtin list — ordered
sequence of elements. It represents one of the most simple and natural
concepts.

>> Finally:
>>
>>        List
>>        Map
>>        Seq
>>        Set
>>
>> vs.
>>
>>        List
>>        Map
>>        Sequence
>>        Set
>
> What about Buffer, Vector, Iterable?

Iterable is unordered (most algorithms operate on ordered seqs).
Buffer is mutable (not functional style). Vector is random access,
that is not important in the most of algorithms.

S.

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Sequence -> Seq

Daniel Sobral gmail.com> writes:
> 1) Readability: long, descriptive names instead of a sea of abbreviations.

As said elsewhere by several people (including me), readability is a main
motivator for keeping frequently used names short. Long names can make code
harder to read if they are repeated lots of times and take attention away from
the interesting part of the code. There is a reason why many languages have
literals for the most used collection constructs.

Unlike Java, Scala is not about making things as long as they can be. We have
type inference and symbolic method names after all. Actually, Java libraries are
a good example of how using very long names does not result in readable code. Of
course, this is all subjective, so this is just my opinion.

Best,
Ismael

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Sequence -> Seq

Ismael Juma juma.me.uk> writes:
> Long names can make code harder to read

Coincidentally, I came across the following link:

http://thedailywtf.com/Articles/CodeThatDocumentsItselfSoWellItDoesNotNe...

It is, of course, not the same as what is being discussed here. Still, it's
funny. :)

Best,
Ismael

Igor Karp
Joined: 2009-09-24,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Sequence -> Seq

On Wed, Sep 23, 2009 at 10:28 AM, Ismael Juma wrote:
> Hi Martin,
>
> martin odersky epfl.ch> writes:
>> I believe character counting is not the best way to design an API.
>
> Definitely not. But short, descriptive and unambiguous names for commonly-used
> classes and methods make for more readable code. Personally, I have 0 concern
> for the extra typing, it's the readability that I am interested in. In effect,
> Seq("foo", "bar", "baz") is our Seq literal syntax and I, for one, use that a
> lot in 2.7.x (more than List("foo", "bar", "baz")). The extra characters
> introduced by Sequence just take more space that could be used by the
> interesting part, the arguments.
>
>> There are two arguments for Sequence in place of seq: Consistency and
>> separation. Consistency: All collection classes except Seq use their
>> full names. Separation: With the soon to be expected arrival of
>> parallel collections, we want `seq' and `par' (in lower case) mean
>> sequential, respectively parallel. So on a parallel collection pxs,
>> you'll be able to write
>>
>> pxs.seq.map(f)
>
> I find this interesting. Why is abbreviation OK here? Shall we be prepared for a
> change to pxs.sequentially.map(f) in the future?

I think separation is a valid argument. But what to shorten depends on
how frequent they would be used.
So if seq (and par) are expected to be used much more than Seq, it
should be short and Seq -> Sequence.
If not than seq -> sequential, par -> parallel.

Igor

>
>> In my mind, the only valid reason to keep Seq is backwards
>> compatibility. But Seq is still present in 2.8, it's just deprecated.
>> So all that's demanded is that at some point in the future of their
>> choosing users do a global search and replace from Seq to Sequence. I
>> thought this is an acceptable demand. If people strongly agree, please
>> speak up!
>
> I find that it's extra effort for the users for no or little gain (at best). In
> the end, however, it's just an annoyance (both the longer name and the forced
> migration). There are certainly issues of higher priority in Scala-land.
>
> Best,
> Ismael
>
>

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

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

normen.mueller
Joined: 2008-10-31,
User offline. Last seen 3 years 8 weeks ago.
Re: Re: Sequence -> Seq

On Oct 1, 2009, at 12:03 PM, martin odersky wrote:
> OK for everyone?

+1

Cheers,
--
Normen Müller

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

On Thu, Oct 1, 2009 at 12:37 PM, Normen Müller <normen [dot] mueller [at] googlemail [dot] com> wrote:
On Oct 1, 2009, at 12:03 PM, martin odersky wrote:
OK for everyone?

+1

Cheers,
--
Normen Müller




--
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
anli
Joined: 2008-08-19,
User offline. Last seen 1 day 48 min ago.
Re: Re: Sequence -> Seq

On Thursday 01 October 2009 14:03:38 martin odersky 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
>

loverdos
Joined: 2008-11-18,
User offline. Last seen 2 years 27 weeks ago.
Re: Re: Sequence -> Seq

On Oct 1, 2009, at 13:03, martin odersky 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
>

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Sequence -> Seq

martin odersky epfl.ch> writes:
> OK for everyone?

Excellent. :)

Best,
Ismael

Tony Morris 2
Joined: 2009-03-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Sequence -> Seq

Yes, thanks.

martin odersky 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
>

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Sequence -> Seq
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?

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

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.

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