News for hackers. Stuff that matters.
Re:Martin Odersky (Scala creator) launches company to commer... by jcarreiro on Thursday May 12, 2011 @12:27PM (#2541143)
I don't much about Scala, but looking at the examples on http://www.simplyscala.com/, it looks like the language has a lot of syntactic sugar. Scala users, is that an accurate assessment or I am misjudging it?
Re:Martin Odersky (Scala creator) launches company to commer... by riobard on Thursday May 12, 2011 @01:14PM (#2541370)
No. On the contrary, Scala has a very minimal syntax. Syntactic sugar are rare in Scala.
Re:Martin Odersky (Scala creator) launches company to commer... by runT1ME on Thursday May 12, 2011 @02:18PM (#2541685)
I disagree. The following all mean the same thing (off the top of my head):

   obj.( (a, b) => a + "." + b)
   obj.(_ + "." + _)
   obj { (a,b) => a + "." + b }
Seems to me that's syntactic sugar. The flexibility of Scala is the source of my love/hate relationship with the language. That being said, it's still my favorite thing to code in when I get the opportunity...
Re:Martin Odersky (Scala creator) launches company to commer... by fhars on Thursday May 12, 2011 @03:08PM (#2541907)
Only the first two mean the same thing, and that is not syntactic sugar, but syntax error:

  error: identifier expected but '(' found.
What you probably meant is that

  a b c
and

  a.b(c)
are the same thing. And admire the effect of the semicolons in http://article.gmane.org/gmane.comp.lang.scala.debate/2231
Re:Martin Odersky (Scala creator) launches company to commer... by runT1ME on Thursday May 12, 2011 @09:59PM (#2543212)
All three can be used for the same functionality:

scala> object Test { | def myMethod( f:(String,String)=>String) { | println("MyMethod result =" + f("a", "b")) | } | } defined module Test

scala> Test.myMethod( _ + "&" + _ ) MyMethod result =a&b

scala> Test.myMethod( (a,b)=> a+"&"+b ) MyMethod result =a&b

scala> Test.myMethod { (a,b)=>a+"&"+b } MyMethod result =a&b

Re:Martin Odersky (Scala creator) launches company to commer... by riobard on Friday May 13, 2011 @12:28AM (#2543544)
Optional dots, semicolons and sometimes parenthesis, underscores as placeholders, and interchangeable parenthesis and braces are about the only syntactic sugar in Scala AFAIK. They are really minimal compared to, for example, Python decorator syntax.
Re:Martin Odersky (Scala creator) launches company to commer... by pdhborges on Friday May 13, 2011 @05:12AM (#2544066)
for loops are also syntactic sugar and the case class matching thing

    case class Lol (a: Int, b: Int)

    Lol(2, 3) match {
       case x Lol y => x
    }
Re:Martin Odersky (Scala creator) launches company to commer... by Meai on Thursday May 12, 2011 @03:01PM (#2541881)
Scala has to be the worst offender of language complexity I have ever seen. A language isn't supposed to make you feel smart, it's supposed to be easy to read, maintain and write powerful code in. Have you had a look at larger Scala codebases? Every single code line needs to be read consciously, quickly scanning over code is impossible with Scala.
Re:Martin Odersky (Scala creator) launches company to commer... by dxbydt on Thursday May 12, 2011 @04:19PM (#2542154)
I think you should look at DSLs. Seriously.

You can code a domain specific options parser in scala so that your final code actually looks like this -

"@ $20 spot, price 5 calls, @ $25 strike, 59 days to expiry"

This is as simple as it can get. In fact, the senior quants literally say the above line word for word. So its practically English. Can't get any simpler than that.

Reference: http://www.scala-lang.org/node/1403

Re:Martin Odersky (Scala creator) launches company to commer... by jrockway on Thursday May 12, 2011 @06:22PM (#2542593)
How much Scala have you read and written? I hear "xxx is too complicated" quite often, and it's always from people whose experience is having visited the language website once or twice.

Of course code is hard to read if you don't know the language.

Re:Martin Odersky (Scala creator) launches company to commer... by Meai on Friday May 13, 2011 @04:05AM (#2543973)
I have read a book on the subject. Look at this code and tell me with a straight face that it's easily readable: https://github.com/jdegoes/blueeyes/blob/master/src/main/sca... The sheer amount of weird language tokens is disturbing.
Re:Martin Odersky (Scala creator) launches company to commer... by smcj on Thursday May 12, 2011 @04:24PM (#2542179)
I had a completely different experience. Code is very readable, because it describes what it does and not how.
Re:Martin Odersky (Scala creator) launches company to commer... by spullara on Thursday May 12, 2011 @04:44PM (#2542241)
Readable but not editable. The person editing or debugging your code needs to know how it does it.
Re:Martin Odersky (Scala creator) launches company to commer... by gtani on Friday May 13, 2011 @07:35AM (#2544277)
Re:Martin Odersky (Scala creator) launches company to commer... by jcarreiro on Thursday May 12, 2011 @01:15PM (#2541373)
Thanks. I'll have to check it out, I love learning new languages. Can you recommend a good Scala book?
Re:Martin Odersky (Scala creator) launches company to commer... by ondrasej on Thursday May 12, 2011 @01:27PM (#2541428)
Definitely Programming in Scala - http://www.artima.com/shop/programming_in_scala. You might find some parts of the book a little boring if you already have experience with functional programming, but it is one of the best books about programming languages I've read (I've only read the second edition, not the one that is available online, but I guess, the first one will be OK as an introduction too).
Re:Martin Odersky (Scala creator) launches company to commer... by tilltheis on Thursday May 12, 2011 @01:25PM (#2541415)
"Programming in Scala" is a good one, I've been told. The first edition is available online at http://www.artima.com/pins1ed/ .
Re:Martin Odersky (Scala creator) launches company to commer... by dxbydt on Thursday May 12, 2011 @01:34PM (#2541470)
don't buy the wampler book as a 1st book. too many forward references, you are constantly flipping pages.

also, portions of the scala api are a work in progress. constructs for multidimensional arrays have changed several times.

i may recommend the wampler book when they come out with a rewrite, say in a few months time. Now it seems too rushed. Some of it reads like a collection of blogposts.

Also wampler's idea of functional programming is very basic. No details on commonly used functional data structures or functional pgmming algorithms. More like "functional pgmming is X as opposed to OO pgmming is Y".

Okasaki's book ( http://news.ycombinator.com/item?id=1138979 ) needs to be written in Scala. That'll sell a boatload of copies. Even a modest attempt at that would work for a start. That's an awesome book.

Re:Martin Odersky (Scala creator) launches company to commer... by stayjin on Friday May 13, 2011 @06:10AM (#2544148)
There is a PDF book called "Scala by example". It is a hands on approach that I find very interesting, because you learn by trying out applied cases.