News for hackers. Stuff that matters.
Re:The state of the Scala website and documentation by philipkglass on Monday October 17, 2016 @04:32PM (#12729428)
Scala was my first serious use of a JVM language and I kept hitting little rough patches that people were assumed to understand from a prior Java background. One example: a month or so into my use I started getting a puzzling failure when sbt was trying to download a dependency. Everybody already knows about Java's security certificate handling, Ivy, and Maven, right? I didn't. I kept on Googling the wrong terms because I was searching for Scala and sbt. The problem turned out (IIRC) to be a dependency download attempt that started from a URL whose certificate was trusted and then got 302 redirected to a mirror whose certificate was not yet trusted by Java. The error messages that actually showed up in my console were not at all helpful and I ended up using tcpflow and a Java-savvy colleague to figure out what was actually happening. Would it be so hard for (e.g.) sbt to provide an interactive security prompt for if you want to trust a remote source's security cert, rather than expecting you to figure out the error message and solve it the Java way with plain Java tools? (Maybe it would be hard. Maybe that's why it doesn't do that. I don't know because I didn't use Java before Scala.)

I don't have concrete examples to hand for the other rough spots but I recall hitting other areas of knowledge that are explained via Java instead of standing on their own. "The Scala Bar is like Java's Foo, but with these improvements..." I never learned the Java Foo and I don't really want to have to acquire a working Java developer's knowledge to use Scala. I'm using Scala and not Java. If you're writing docs for Scala and the reader needs to know something important about either Java-the-ecosystem or Java-the-language, please inline that knowledge.

Re:The state of the Scala website and documentation by lmm on Monday October 17, 2016 @05:35PM (#12729999)
I wouldn't recommend SBT, especially for beginners (Maven is much better documented), but no, it can't give you a prompt because programs don't have access to modify the keystore by design. The JVM is one of the few platforms that actually has a decent go at security, which sometimes means usability suffers.
Re:The state of the Scala website and documentation by jackcviers3 on Monday October 17, 2016 @05:51PM (#12730123)
To use scala effectively, you must use SBT. Almost every scala library and framework is built using it. There are tons of productivity enhancing tools wrapped in plug-ins for it. It is java, scala and scalajs aware, and incrementally compiles large projects if you use it. The documentation for it is good from version 0.12 on. You can learn 90% of what you need to do scala builds in SBT in 4 hours by reading the documentation and the walk-through tutorial. Eventually you may need to write your own tasks, but 90% of those tasks are covered by the existing plug-ins available, and you can easily modify or create a new task by writing some simple scala function on your first day using the tool without having to publish a plug-in to some repo for it to work.

I absolutely would reccommend SBT for beginner scala users. It's a must to use and understand it, as much a part of understanding scala as understanding for comprehensions, case classes, and if/else expressions.

Re:The state of the Scala website and documentation by denis1 on Monday October 17, 2016 @05:58PM (#12730176)
Using SBT with Scala is certainly encouraged, but you can use other build tools. At work we're successfully using gradle without too many problems. The only things that are slightly weird are the not-so-perfect plugins for gradle, but that is understandable considering they are mostly community driven (sometimes only a one person even).
Re:The state of the Scala website and documentation by vorg on Tuesday October 18, 2016 @01:02AM (#12732241)
> the not-so-perfect plugins for gradle

Could be because Gradle up to version 2.x provided only Groovy for writing plugins and build scripts. Gradle 3.0 was released a few months ago, and provides both Kotlin and Groovy for plugins and builds, and even prefers Kotlin for writing plugins. Perhaps the "not-so-perfect" situation will change as plugin providers switch over.

I recently looked into Groovy's apparent popularity at #17 on the TIOBE ranking and found Baidu was giving a result 12 times too high and Yahoo a result 20 times too high, both of which would skew the ranking. Groovy's real ranking is somewhere below that of #50 ranked Clojure. These results are being used to promote Groovy as successful to the Apache Software Foundation directorship. I can understand Gradleware wanting to switch to a language with a seemingly more honest approach to promotion.

Re:The state of the Scala website and documentation by lmm on Tuesday October 18, 2016 @04:37AM (#12732928)
Libraries and frameworks use SBT because they need to cross-build for multiple scala versions - that isn't something you normally need to do as a "regular" developer. Even post-0.12 the documentation is a lot lot worse than maven's. You can absolutely use Scala effectively without it.
Re:The state of the Scala website and documentation by philipkglass on Monday October 17, 2016 @06:48PM (#12730529)
I was hired to work on an existing codebase that used sbt. I had domain knowledge and plenty of general development experience but I hadn't used Java, the JVM, or Scala for production code before. My previous background was C, Fortran, Python, and JavaScript (scientific computing and web dev).
Re:The state of the Scala website and documentation by Scarbutt on Monday October 17, 2016 @05:41PM (#12730054)
I hope you don't try Clojure then, is much worse there ;)

Joking aside, in Clojure this a feature, one of Clojure's theme is "embrace the host"(leverage java apis).

I don't know Scala but in Clojure you definitely need to become familiar(if you aren't) with Java if you are serious about writing productions apps in it.

Also, abstractions leak.

Re:The state of the Scala website and documentation by cutler on Monday October 17, 2016 @05:48PM (#12730102)
I've been using Clojure happily for years without needing to dip into Java for anything other than something like parseInt(). Leiningen is a joy to use compared with anything Scala has to offer and Clojure also has its own library repository. When I asked on IRC where to find Scala libraries I was advised to go scavening on Maven Central. Jeez.
Re:The state of the Scala website and documentation by amelius on Monday October 17, 2016 @06:35PM (#12730438)
> I've been using Clojure happily for years without needing to dip into Java for anything other than something like parseInt()

You needed to dive into Java to figure out something as basic as parseInt?

Re:The state of the Scala website and documentation by cutler on Monday October 17, 2016 @06:47PM (#12730517)
I said "dip into", not "dive into" and by dip into I meant discovering I needed Java rather than a Clojure function.
Re:The state of the Scala website and documentation by amelius on Monday October 17, 2016 @07:24PM (#12730740)
I didn't mean to offend you. I don't know Clojure or Java, and was just wondering why you need to look into the internals of Clojure for something as basic as parseInt.
Re:The state of the Scala website and documentation by jakebasile on Monday October 17, 2016 @08:00PM (#12730927)
Clojure.core doesn't have a parse integer function. You use Java interop to get one. It's as simple as '(Integer/parseInt "42")'
Re:The state of the Scala website and documentation by puredanger on Friday October 21, 2016 @11:05AM (#12761020)
You can use the built-in read-string too to generically read a string as Clojure data: `(read-string "42")`
Re:The state of the Scala website and documentation by oxyclean on Tuesday October 18, 2016 @08:04AM (#12733616)
The function is simple enough that clojure doesn't make its own wrapper for it, so you wind up doing this:

(.parseInt Integer x)

That may be what he means by dive into Java.

Re:The state of the Scala website and documentation by hocuspocus on Monday October 17, 2016 @06:05PM (#12730217)
To be fair, package managers and SSL certificate issues are a PITA in pretty much all ecosystems.

On the JVM, even if you stick to pure Java, you still need to figure out where and how the dependency resolver is launched before you can override its settings, which can depend on things like your build tool and IDE. But at least, adding your own certificates to the keystore/truststore is fairly straight-forward.