News for hackers. Stuff that matters.
Re:Kotlin: A New Hope in a Java 6 Wasteland by bad_user on Monday September 28, 2015 @12:50PM (#10291412)
I'm a Scala developer and personally I believe that such claims are unwarranted, mostly coming from beginners with a superficial understanding of the language. Not only is Scala not a kitchen sink, but it actually cuts down on Java features that were a bad idea.

This misunderstanding mostly happens because some people start learning Scala in the hope of finding a better Java. But Scala is not a Java++, but something else entirely, being the kind of language that makes sense outside the boundaries of the JVM.

As a piece of advice, if you aren't interested in trolling, you might want to name actual things that you don't like, as in things that you can talk about, instead of things that are non-falsifiable. That way, in case you have a point, then other people or even Scala's or Kotlin's language designers can learn from your feedback. And if you don't have a point, then you might get some useful piece of advice.

On Kotlin - I don't like that it doesn't diverge enough. This is because when picking a non-mainstream language, you lose the advantages of mainstream languages, like easily available documentation, copy/paste-able samples, big developers pool, etc, etc... so the advantages of the non-mainstream language would better be worth it to balance the disadvantages ;-)

Re:Kotlin: A New Hope in a Java 6 Wasteland by adrusi on Monday September 28, 2015 @04:26PM (#10292952)
C++'s goal was to introduce a newly popular paradigm (oop) on top of an existing rich ecosystem (c). Scala's goal was to introduce a newly popular paradigm (fp) on top of an existing rich ecosystem (java). They both suffer from poor tooling, long compile times, and feature bloat with several predominant styles of writing it.

To dismiss the similarities is disingenuous.

Re:Kotlin: A New Hope in a Java 6 Wasteland by bad_user on Monday September 28, 2015 @05:27PM (#10293330)
Yeah, both are programming languages. Objective-C was also built on top of C, with the same original purpose as C++, yet you couldn't find two other mainstream languages that differ so much.

I can't really answer to your argument because it is superficial and there isn't anything in there to answer to. Whenever I ask folks what makes Scala complex or bloated, or what the conflicting "styles of writing it" are there, they always shy away. Because it's easier to be handwavy than it is to construct a good argument.

Unfortunately handwavy arguments are subject to marketing and social forces. This is how people end up worshiping Python's spirit and included batteries, which must be some of the biggest lies in our industry, since I can name more non-orthogonal and half-baked features in Python than in Scala, plus several clusterfucks in its standard library and ecosystem, starting from the build management tools, the async-I/O libraries and the web libraries, all of them screaming anything else but "there is only one way to do it". But that's just the herd mentality in action.

Re:Kotlin: A New Hope in a Java 6 Wasteland by adrusi on Monday September 28, 2015 @10:14PM (#10294383)
On Objective-C: yes, it's quite different from C++; that's because it took a very different approach to integrating object oriented programming into C, and because it had a much more traditional (at the time) model of what object oriented programming was. Essentially, Objective-C adds a completely new language for object oriented code, one which has a very good zero-overhead C FFI and one which happens to be source compatible with C. C++ really tries to make one cohesive language, so that you don't have that dichotomy (although it doesn't always succeed when it comes to templates).

Yes, Scala isn't exactly the C++ formula applied to java and functional programming; it doesn't, for example, strive for source compatability (C++ has to because of header files, it likely wouldn't otherwise).

Whenever I ask folks what makes Scala complex or bloated, or what the conflicting "styles of writing it" are there, they always shy away.

I don't think there's a good way to identify concrete examples for "bloatedness" because it's kind of a fundamentally handwavy concept. It's a feeling that you get while learning and using the language. One that people don't get with C, or Go, or Haskell or Scheme, but tend to get with Scala and C++ and Common Lisp, to name examples.

Complexity is easier to point to though. The interaction of inheritance and generics, the mutability semantics, the fact that it's not clear from the call site when arguments get evaluated (with defered evaluation and macros), anything that can result from an abuse of implicits, mutability semantics.

The various styles of writing Scala? Well there's the people who wanted to write Haskell but settled for Scala because it's what their bosses gave them, who write it with a lot of immutability and use the type system to a great extent. There's the people who wanted to write java but write Scala because their bosses make them, who write java in Scala because that's a totally viable way to do it. And there's a lot of people in the middle.

Addressing your python point: I agree that the "there's only one way to do it" mantra is kind of wrong in pythonland, but there are a lot of conventions in that community that people adhere to that make it true in a way. This comes with a lot of dogma unfortunately. Other languages have fewer "non-orthogonal and half-baked" features. Go, for all its issues, doesn't have many of those because it seems its designers are content to just not have the features at all rather than have them be imperfect. C doesn't either, really, nor Haskell.

Re:Kotlin: A New Hope in a Java 6 Wasteland by mike_hearn on Monday September 28, 2015 @06:07PM (#10293550)
If you would like a specific, concrete issue with Scala, I find its documentation to be extremely poor compared to Kotlin.
Re:Kotlin: A New Hope in a Java 6 Wasteland by justthistime_ on Monday September 28, 2015 @06:35PM (#10293656)
It's easy to say "Kotlin has no projects with poor documentation" when it doesn't have many projects at all. :-)

I think Scala library authors would love some links to those things where you consider the documentation to be lacking.

Re:Kotlin: A New Hope in a Java 6 Wasteland by mike_hearn on Tuesday September 29, 2015 @01:21PM (#10297815)
I wasn't talking about projects written in the language, I was talking about the language itself.
Re:Kotlin: A New Hope in a Java 6 Wasteland by pjmlp on Tuesday September 29, 2015 @02:08AM (#10294846)
You got it wrong.

C++ goal was that Bjarne didn't want to code ever again in plain C, after being forced to use it.

It just felt wrong to him such a primitive language after his experience with Simula and other proper languages of the day.

So when he joined AT&T, he started to work a way to have Simula for his work. Then the language grew from there.

There a few Bjarne interviews were he tells this.

Re:Kotlin: A New Hope in a Java 6 Wasteland by frankzinger on Tuesday September 29, 2015 @12:23AM (#10294667)
Regarding C++ having poor tooling: care to elaborate a little? Just one or two specific examples.

I know the grammar is really difficult to parse and that has hindered static analyzers in the past, for example, but what else are you talking about? Also, how good or bad is clang's static analyzer compared to those of other languages?

Re:Kotlin: A New Hope in a Java 6 Wasteland by justthistime_ on Monday September 28, 2015 @06:24PM (#10293609)
There so many things different in C++' approach compared to Scala that your whole comparison is disingenuous to begin with.

I think

    I believe that such claims are unwarranted,
    mostly coming from beginners with a superficial
    understanding of the language
fits fairly well here ...
Re:Kotlin: A New Hope in a Java 6 Wasteland by krschultz on Monday September 28, 2015 @05:19PM (#10293282)
That's not trolling at all. I work at Gilt. We're always cited as one of the biggest Scala proponents. I still think the analogy to C++ is adapt.

C++ is a great language. Scala is a great language. Both are huge and require knowing which parts to work with.

Re:Kotlin: A New Hope in a Java 6 Wasteland by bad_user on Monday September 28, 2015 @05:30PM (#10293352)
I wasn't saying that you're trolling, I was just asking about reasoning since I'm curious.
Re:Kotlin: A New Hope in a Java 6 Wasteland by incepted on Monday September 28, 2015 @01:07PM (#10291520)
> you might want to name actual things that you don't like, as in things that you can talk about, instead of things that are non-falsifiable.

Sure, I could name things that I don't like but they will be by definition non falsifiable as well, so I don't really see the point of what you're asking.

Overall, I just find the surface area of Scala way, way too big. I felt the same way about C++ compared to C in the 90s, hence my comparison. I've used Scala for five years and over that period of time, I've seen the language adding feature over feature instead of addressing critical aspects such as good IDE support or decent build tools.

I'm still stuck with Scala at work but I'm really hoping Kotlin takes off because using it on my personal projects has been a breath of fresh air compared to Scala. It's like getting 90% of the power of Scala with 5% of the cognitive load.

Re:Kotlin: A New Hope in a Java 6 Wasteland by bad_user on Monday September 28, 2015 @02:46PM (#10292181)
Here's the reason for why I asked. You're saying that:

> I've seen the language adding feature over feature instead of addressing critical aspects such as good IDE support or decent build tools

Well, Scala 2.11 hasn't added any features, being a release meant for stabilizing, modularizing and optimizing the compiler and the library, fixing many non-withstanding issues. So zero new features.

Scala 2.10, released Jan/04-2013 (2 and a half years ago, OK?), was the release that added some features which included Value Classes / Implicit Classes (they are linked, for providing extension methods, as a refinement of implicit conversions), String interpolation (any sane language has it, plus Scala can now deprecate the conversion to String that was imported from Java), plus macros as experimental. Besides macros, everything else is minor and macros are meant for library authors as a neater way of building compiler plugins.

Scala 2.9, released May/12-2011, only includes changes to the standard library and not the language.

Scala 2.8, released Jul/14-2010 (5 years ago), introduced named and default arguments, package objects, changes to implicits, type constructor inference and a completely redesigned collections library. This release was so big for its users that it should have been called Scala 3. Before Scala 2.8 the language wasn't suitable for usage and Scala 2.11 is pretty much the same language as Scala 2.8.

So I'm really wondering what "feature after feature" you're referring to. Really, take other programming languages that aren't Java and compare the features added in the last 5 years to Scala's history. You'll have a surprise ;-)

Also IntelliJ IDEA is pretty awesome for Scala, I've been using it for the last 3 years. It's worse than IntelliJ IDEA for Java, but it is better than Eclipse for Java or Visual Studio for C#. There's also Scala IDE (built on top of Eclipse) and Ensime (a pretty capable Emacs / Atom / SublimeText plugin). Other platforms can only dream of such support, including Kotlin, or C# for that matter. I'm not joking.

> Sure, I could name things that I don't like

So why don't you name those things that you don't like?

Re:Kotlin: A New Hope in a Java 6 Wasteland by incepted on Monday September 28, 2015 @02:57PM (#10292275)
> So why don't you name those things that you don't like?

Because then you will tell me that I don't like these features because I don't understand them?

But alright, here are a few:

- The type projector lambda syntax is absurdly arcane: `({type λ[α] = Either[A, α]})#λ]`

- The curry syntax is silly as well (multiple parentheses)

- The "_" character has eleven different meanings depending on where it's used [1]

[1] http://stackoverflow.com/questions/8000903/what-are-all-the-...

Re:Kotlin: A New Hope in a Java 6 Wasteland by bad_user on Monday September 28, 2015 @04:48PM (#10293091)
Personally I'm not having discussions about Scala with the purpose of winning arguments, but rather with the purpose of clearing misunderstandings and this goes both ways.

The "_" character is a placeholder for things that can be named, but for which you don't care about that name. And because you don't care about the name, it can function as a wildcard (i.e. any). To me all use-cases of the underscore make perfect sense and I can't remember a single instance in which I was confused by its meaning.

Type lambdas are arcane, but as @lmm points out, this is more about the absence of a feature. Basically in Scala type lambdas do not have first class support and so they are based on Scala's abstract types.

As to why they don't have first class support? Well, because people complain about too many features ;-) But it's worth pointing out that the TypeLevel folks have plans to introduce first-class support in their fork and thus propose an improvement. And also, because of the work that happened in Dotty, Scala the language is heading towards a DOT calculus foundation, along with a unification of higher kinded types with abstract types, which should iron out the edge cases.

The curry syntax seems silly if you come from SML, Ocaml, Haskell or languages from the ML family in general. In such languages all functions have exactly one argument. But Scala is not an ML language and so it doesn't do currying by default. It's annoying sometimes, but as with all design choices there are disadvantages and benefits.

Re:Kotlin: A New Hope in a Java 6 Wasteland by lmm on Monday September 28, 2015 @03:13PM (#10292389)
The type lambda syntax is arcane, but that's not a feature - indeed if anything it's the absence of a feature (would you favour explicit support for type lambdas, like the plugin does?). If you're complaining about the syntax of curried functions then again that's not a complaint about a feature; likewise _.

I'm not saying they aren't issues, but none of the things you mention is about Scala having "too many features".

Re:Kotlin: A New Hope in a Java 6 Wasteland by yawaramin on Monday September 28, 2015 @08:38PM (#10294121)
To be fair, isn't type projection a Scala feature? Have you ever seen another language that can do it?
Re:Kotlin: A New Hope in a Java 6 Wasteland by lmm on Tuesday September 29, 2015 @02:52AM (#10294932)
It's not a language-level feature. It's a pattern that makes use of several features - type members, structural types, member selection. (You can often write these things more readably by splitting them onto two lines, putting the type alias in one place and the use of it in another, avoiding the need for the structural type and member selection). It's like the visitor pattern in a language that doesn't have pattern matching, or an explicit Y combinator in a language that doesn't have recursion.

Some newer languages have this kind of functionality (in Haskell it's a GHC extension, I think).

Re:Kotlin: A New Hope in a Java 6 Wasteland by whateveracct on Monday September 28, 2015 @01:28PM (#10291673)
Scala's surface area isn't especially large though? Here's a list of Scala language-specific features I use & have to keep in my head on a daily basis:

- Case classes + sealed hierarchies (algebraic types, in other words)

- Implicit parameters

- Collections library

- Traits

- Function types, currying, partial application

- for-yield

- Pattern matching

None of those concepts on their own are especially complicated. In fact, I find Scala to have a bunch of orthogonal features that are easy to understand on their own and that compose in a variety of useful ways.

Re:Kotlin: A New Hope in a Java 6 Wasteland by incepted on Monday September 28, 2015 @02:04PM (#10291920)
> Scala's surface area isn't especially large though?

You'll find plenty of disagreement with that feeling everywhere you ask...

The fact that you choose to use a small subset of all these features is irrelevant: eventually, you have to hold all the language in your head because you will work with other people and other organizations that have different standards than you do.

Which is why it's so important for a language to learn how to say "no" to new features, something I feel Scala has been unable to do.

Re:Kotlin: A New Hope in a Java 6 Wasteland by whateveracct on Monday September 28, 2015 @02:28PM (#10292073)
What other features could someone even reasonably use though? I say this because what I listed above isn't some small subset of Scala. It's actually the majority of the language.

Hmm I'll try to think of some features that we don't use at work that would add additional semantic overhead:

- Inheritance? I mean okay but nobody I work with makes heavy use of this anyways and if I were working in a Scala shop where inheritance was used heavily it would be like working in a different language. So I suppose I'll give you that although I don't see how that makes the language hard to learn or work with.

- Mutable collections + references (vars)? Once again nobody I work with uses these outside of local mutability when they fail to be able to leverage immutable abstractions that do the same thing. If I worked in a Scala shop where mutability was used without care, it would be like working in a different language entirely true.

- while loops? I don't know what else I'm grasping for straws here.

If anything, the additional 'complicated' things we use in Scala aren't language features but rather libraries, mostly scalaz/shapeless.

Re:Kotlin: A New Hope in a Java 6 Wasteland by dragonwriter on Monday September 28, 2015 @05:34PM (#10293377)
> If anything, the additional 'complicated' things we use in Scala aren't language features but rather libraries

One thing with Scala is that various features of the language allow libraries to reshape the "feel" of the language, because a number of things that would be fixed in the language in many other languages can be modified by libraries in Scala.

Re:Kotlin: A New Hope in a Java 6 Wasteland by mike_hearn on Monday September 28, 2015 @06:23PM (#10293604)
Consider that whilst Kotlin does not support things like function currying and partial application out of the box, they can both be added by a library (funktionale). Kotlin has a focus on DSLs defined in libraries and has a few language features that are intended to make them work better, in this sense, Kotlin and Scala are similar.
Re:Kotlin: A New Hope in a Java 6 Wasteland by dragonwriter on Monday September 28, 2015 @07:00PM (#10293751)
Right, but by comparison Scala goes further than Kotlin on this. Consider the case of operators, for instance: Kotlin, like many languages, lets you redefined a predefined set of operators for new types with predefined precedence, Scala lets you create entirely new operators.

To some, this is a strength for Scala -- to others, it is a weakness.

Re:Kotlin: A New Hope in a Java 6 Wasteland by whateveracct on Monday September 28, 2015 @02:32PM (#10292098)
Also IDE support in Scala is pretty much fine. Have you used it lately? IntelliJ is able to handle my code fine in almost all cases, and I make heavy use of scalaz and occasionally what Scala has for dependent types. The only problems I ever run into are IntelliJ sometimes telling me I don't use an import for a typeclass instance that I am definitely using.
Re:Kotlin: A New Hope in a Java 6 Wasteland by narrator on Monday September 28, 2015 @04:18PM (#10292902)
I love Scala but the Intellij support is lacking in that it can't always find the right import to auto-import and I have to manually add it myself. I think it comes down to the fact that it takes the compiler a lot of cpu cycles to figure out what's actually in scope with implicits, etc. I soldier through it, but it can be annoying when I have to go hunting around for the import.
Re:Kotlin: A New Hope in a Java 6 Wasteland by bad_user on Monday September 28, 2015 @04:57PM (#10293145)
IntelliJ IDEA's auto-import works fine for normal imports. But it cannot guess what implicits you need imported in scope any more than the compiler can.

The only implicit (I can think of) from the standard library that needs to be explicitly imported is ExecutionContext.Implicits.global. It's a form of dependency injection meant for working with Future and the error message tells you exactly what to do, but it can't be automatically imported because the thread-pool used is a pretty big deal and you should pause for a second to think about it. Other than that, the implicits you need are probably your own doing, because common libraries usually have a design where you get everything needed with sensible defaults.

In other words, if it's painful to import, then you should probably rethink it. This is actually a very good rule for Java as well. People too often rely on IDEs to do the boring parts, not noticing the stench until it is too late.

Re:Kotlin: A New Hope in a Java 6 Wasteland by draven on Tuesday September 29, 2015 @04:50AM (#10295203)
As said on http://www.scala-lang.org/api/2.11.7/index.html#scala.concur... the default global should not be imported all over the place. It's better to declare functions with an implicit ExecutionContext and try to declare your execution contexts in a few well-known places.

The (web) app I'm working on uses several ExecutionContexts (database access has a specific one for example.)