fun fact

130 views
Skip to first unread message

Petar Maymounkov

unread,
Jan 9, 2010, 9:03:32 PM1/9/10
to golang-nuts
I have reimplemented a networking project from Scala to Go.
Scala code is 6000 lines. Go is about 3000.

Even though Go does not have the power of abbreviation,
the flexible type system seems to out-run Scala when
the programs start getting longer.

Hence, Go produces much shorter code asymptotically.

--Petar

Sonia Keys

unread,
Jan 10, 2010, 2:38:04 AM1/10/10
to golang-nuts
Similarly, I reimplemented a scientific project from python+numpy to
Go. It grew a bit, from 900 to 1200 lines, but I thought that wasn't
so bad considering I was missing not only array operators for my four
dimensional arrays, but, well, a number of other things. None of
these things were hard reimplement. The code reads about the same.

Vincent Foley

unread,
Jan 10, 2010, 2:00:24 PM1/10/10
to golang-nuts
Can you tell us what caused the Scala version to be so much longer?
Often, I find that in languages like Scala where you can make things
more abstract, I tend to do so, even if I don't have to.

Vincent.

On Jan 9, 9:03 pm, Petar Maymounkov <pet...@gmail.com> wrote:

David Flemström

unread,
Jan 10, 2010, 4:05:56 PM1/10/10
to Petar Maymounkov, golan...@googlegroups.com
As a reader of both the golang-nuts and the Scala mailing list, I'd be interested to know in exactly what areas it was possible to remove that amount of code.

Is it related to that Go has access to much easier-to-use networking libraries, while Scala does not (Scala uses the Java networking libraries, and thus has to use sub-optimal syntax)?

Or was it because you used code that was a lot more abstract in Scala, while you did a more concrete implementation in Go?

Petar Maymounkov

unread,
Jan 10, 2010, 6:49:55 PM1/10/10
to golang-nuts
Writing wrappers for Java's net for Scala was a small part of it.

In general, yes, it seems that Scala leads towards abstraction,
which increases writing.

I will try to fish out specific examples at some point.

--Petar

Vincent Risi

unread,
Jan 12, 2010, 2:13:57 AM1/12/10
to golang-nuts
This seems to indicate a poor implementation of the Scala code, so I
guess a solid example of the size difference would be useful.
Otherwise it seems like a case of comparing apples and bananas.
Reply all
Reply to author
Forward
0 new messages