News for hackers. Stuff that matters.
Re:The Last Hope for Scala's Infinity War [video] by tunesmith on Wednesday July 11, 2018 @04:05PM (#17509898)
I thought this was a potentially strong argument delivered weakly.

First, he poisons the well by talking about "integrity" and "intellectual honesty". This is a bad move at the beginning of a speech because it is far too easy to take it such that people with different conclusions are lacking in those qualities. Given his delivery, I suspect that he might actually believe that. It would be better if he just owned that this was his opinion and delivered it respectfully.

Second, the section on academic priorities was weak. He spent a large portion of the talk highlighting the mission statements of various languages, which is marketing language. But if Scala made no other changes other than its marketing language, it would not solve the problems he was highlighting. I thought too much time was spent on that part of the talk. There's another moment later in his rushed conclusion where he made stronger points that could have been fleshed out - how the academic influence leads to theoretical features that later get abandoned when the academic project is completed. (And I quite liked his revised marketing statement for Scala.)

I also didn't like that he brought up Cats vs scalaz as a flaw with the community, given that it became clear later in the talk that he had a clear bias on which was preferable. That seemed needlessly provocative.

I think the final conclusion of abandoning the OO path was interesting and fun to think about! I don't know if there's already an opinionated compiler plugin that discourages the more OO techniques while encouraging FP techniques, but I can see how that would be a lot of fun to play with, and educational in the same way that static analysis tools are. (I don't understand why "partial functions" was crossed out as something to abandon, though.)

Re:The Last Hope for Scala's Infinity War [video] by lmm on Wednesday July 11, 2018 @05:00PM (#17510238)
Discouraging OO would be the worst thing Scala could do. Its one really unique capability is the fusion of OO and functional: it's a language that can go toe-to-toe with Haskell, yet also one that lets you switch from Java in a weekend. Take away the OO support and you'd have just another functional also-ran.

Sadly while the language itself has excellent OO support and Java interop, the community support just isn't there (by which I mainly mean: too many people like DeGoes will shout you down rather than trying to help you).

Re:The Last Hope for Scala's Infinity War [video] by the_af on Wednesday July 11, 2018 @05:57PM (#17510598)
I dunno, I think the DeGoes has a point. Like he says near the end, there's this fiction that an OOP+FP hybrid will be loved by both OOP and FP programmers, when many times it actually means both will dislike it and the language will be mediocre at both goals.

My opinion -- and I mostly write Scala in my day job! -- is that Scala is in a truly difficult position. Its OOP (and Java) DNA hurts its FP aspects. If it goes full hardcore FP, it will probably lose relevance (because most programmers can't be bothered with it, and those who can will probably hope for Haskell on the JVM). If it stays like it is and tries to be a "better Java", it will keep losing ground to more practical and "easier" languages on the JVM, possibly including losing to Java itself!

PS: DeGoes didn't sound disrespectful to me, and bear in mind I don't know who he is. He seemed to be arguing out of practicality, not shouting people down. I don't if he is angrier in other forums, but his tone in this presentation sounded closer to a wake up call to me.

Re:The Last Hope for Scala's Infinity War [video] by lmm on Thursday July 12, 2018 @01:24AM (#17512357)
> If it stays like it is and tries to be a "better Java", it will keep losing ground to more practical and "easier" languages on the JVM, possibly including losing to Java itself!

Well, to my mind the FP is a means to practical ends. I'm not attached to Scala qua Scala, I'm attached to HKT and typeclasses because there are practical problems I can't solve without them. As long as Scala has those things and Java or Kotlin don't, Scala will have an advantage - and if Java does adopt those things I'd say mission accomplished. (I mean, Odersky's original goal was to improve Java, right?)

Re:The Last Hope for Scala's Infinity War [video] by dragonwriter on Wednesday July 11, 2018 @06:53PM (#17510869)
> there's this fiction that an OOP+FP hybrid will be loved by both OOP and FP programmers

That seems more of a strawman than a fiction: I've never seen anyone, especially in the Scala community, suggest this.

I've seen lots of people suggest that OOP+FP fusion is what allows Scala to provide an easy gradual on-ramp to FP for people and projects transitioning from Java, which is Scala’s key value proposition.

Re:The Last Hope for Scala's Infinity War [video] by joefkelley on Wednesday July 11, 2018 @08:28PM (#17511327)
> I've seen lots of people suggest that OOP+FP fusion is what allows Scala to provide an easy gradual on-ramp to FP for people and projects transitioning from Java, which is Scala’s key value proposition.

I feel like I'm at the tail end of that on-ramp, and while I'm still as a whole really appreciating scala, I'm starting to wonder what the end-game is.

Now that I understand and am comfortable with all the functional stuff, I'm left wondering why I still have the OOP stuff, and why some of the FP stuff isn't more natural. I guess you still need some OOP for java interop, but the pure-scala ecosystem is pretty significant already.

I guess what I'm saying is that the easy transition from Java is only a benefit for bringing people in, not for a language as a mature ecosystem. And I'm thinking maybe I should get into one of the full-FP languages.

In fact, if anything, what's keeping me from making the switch is not any OOP features, but actually just imperative! Especially for performance-sensitive sections, and some rare-but-necessary data structures, it seems you really do want a small amount of mutable state.

Re:The Last Hope for Scala's Infinity War [video] by vorg on Wednesday July 11, 2018 @08:52PM (#17511419)
> scala, I'm starting to wonder what the end-game is

The end game back in the early days of Scala was probably to provide a gradual on-ramp to FP for people and projects transitioning from Java, but it probably changed to a commercial purpose once more people got involved in its development. It's long since become a self-preserving product, and probably even tries to hinder people moving from FP-only Scala on to Haskell and the like.

I only spent a few months on Scala way back so don't know for sure, but I did see Apache Groovy go through a similar business re-purposing. It began as a JVM-based scripting language complementing Java, useful for glue code and testing, but later became a competitor to Java and other statically-compiled JVM languages, and even tried unsuccessfully to target Android.

Re:The Last Hope for Scala's Infinity War [video] by zmmmmm on Wednesday July 11, 2018 @10:48PM (#17511819)
Funny I was thinking of Groovy while reading the parent as well. I always feel like any language that defines itself in the shadow of another language is challenged to find its own true identity. Something I like about Groovy though is that it doesn't have pretenses: it shamelessly tries to be as close to Java as it can. They are busy right now redesigning the syntax so you can write '=>' instead of '->' in lambdas just so it can be more "java-like". I can't think of a more pointless change from a functional point of view but they are doing it anyway. When I use Groovy, I'm not doing it because "Java is bad", I'm using it because "Java is good" but "Groovy is better". When I code in Scala I keep feeling bad every time I divert back to Java-style and constantly struggle to figure out what paradigm is right and when to switch between them.
Re:The Last Hope for Scala's Infinity War [video] by lmm on Thursday July 12, 2018 @09:57AM (#17514596)
> When I use Groovy, I'm not doing it because "Java is bad", I'm using it because "Java is good" but "Groovy is better". When I code in Scala I keep feeling bad every time I divert back to Java-style and constantly struggle to figure out what paradigm is right and when to switch between them.

Take it slow, and don't expect to be using every Scala feature/library/pattern from day 1 - there is a lot of depth to functional idioms, the learning curve of something like Haskell has less to do with syntax than you might think. Write code that does things that are useful to you - even if you're only writing "Java without semicolons", you're getting value out of Scala - and adopt the fancier features one step at a time. I've been working in Scala for 8 years and there are still places I'd fear to tread (why do I care if my profunctor has strength?), but every year I've produced more concise, clearer, less buggy code than the year before, and even in year 1 I was doing as good as I had been in Java or Groovy.

Re:The Last Hope for Scala's Infinity War [video] by the_af on Wednesday July 11, 2018 @07:18PM (#17510999)
Well, "love" is obviously an extreme, but I think I know what DeGoes means. I know I've cursed at Scala's Java/OOP heritage more than once. I've also puzzled over the related issue of how complex some of Scala's function signatures are (or used to be; I know there's work on this) compared to equivalent Haskell functions.

It seems to me DeGoes is arguing that Scala's "key value proposition" is a losing battle, because other languages are starting to do it much better. It's likely that the "practical programmer" will go with Kotlin or even the next iterations of Java, and the rest... well, you can guess the reaction of the audience to his question ("how many of you would work with Haskell if you could?"), and I must take his assertion at face value that in Scala conferences, the more popular talks are about FP, not about OOP or even FP+OOP. Maybe he's wrong about this, of course.

Again, I'm saying all this as a Scala practitioner. I'm not leaving it for Kotlin either. Then again, I certainly would work with Haskell if I could!

edit: one more thing:

> "I've seen lots of people suggest that OOP+FP fusion is what allows Scala to provide an easy gradual on-ramp to FP for people and projects transitioning from Java"

In my experience, this ramping up to FP happens in one of two ways with Scala:

- Completely ad hoc, misunderstanding every principle and making a Frankenstein's monster out of it. No lessons learned, just a mess that "works".

- Understanding it and doing it with care, and mentioning Haskell a lot (as these people start to read articles and watch tech talks on FP).

This is entirely my personal experience and probably won't generalize to every workplace.

Re:The Last Hope for Scala's Infinity War [video] by shmish111 on Wednesday July 11, 2018 @07:26PM (#17511044)
Why can't you work in Haskell?
Re:The Last Hope for Scala's Infinity War [video] by the_af on Wednesday July 11, 2018 @07:32PM (#17511070)
There aren't many Haskell jobs where I live, I don't want to move, and it's unfeasible to suggest it at my (otherwise decent) job.
Re:The Last Hope for Scala's Infinity War [video] by shmish111 on Thursday July 12, 2018 @04:39AM (#17513052)
Ok, I just want people to not think there are no Haskell jobs out there. The only reason not to be able to get one is if you don't want move and can't find something remote (although there are a few remote jobs around). There are otherwise plenty of Haskell jobs for those that are looking and sometimes in unusual places such as Alaska!
Re:The Last Hope for Scala's Infinity War [video] by dwohnitmok on Wednesday July 11, 2018 @05:56PM (#17510595)
A minor note concerning the usual characterization of the Scala language itself as a fusion of OO and functional, it's definitely not an equal fusion. Not that you proposed that the fusion is equal, but I see it come up elsewhere.

The core language is very much OO. The functional aspects of Scala are either syntax sugar that desugars to OO stuff (e.g. automatic eta expansion, special syntax for defining FunctionN vs new classes, case syntax for partial functions, context bounds) or decisions made by the standard library (e.g. the prevalence of immutable data structures).

Understanding this has been the key for me to understanding where most of the warts of Scala come from. For example some of the weirdness of functions vs methods, weird performance issues, the existence of some of the encoding tricks that libraries like cats and scalaz use, and strange decisions made in the collection libraries all can be fundamentally traced back to this layering.

That being said you can do a lot of FP in Scala because of the combination of ecosystem and syntax sugar, but you have to always keep in mind that you're encoding FP concepts with OO tools (not as equals) otherwise Scala's limitations will come back to bite you.

Re:The Last Hope for Scala's Infinity War [video] by jerf on Wednesday July 11, 2018 @05:26PM (#17510419)
"(by which I mainly mean: too many people like DeGoes will shout you down rather than trying to help you)."

Proposition for discussion (i.e., I don't necessarily believe this, but I don't necessarily not either): The biggest challenge facing languages and their communities that focus on correctness is that the very personality types that are willing to focus on them are also statistically much more likely to be, ah, potentially less suited to the sorts of compromises and engineering discussions that are necessary to make a personal language than other more pragmatic communities. The sort of relatively uncompromising spirit necessary to swim upstream against the current general consensus of very pragmatic programming nearly entirely unconcerned with academic-type correctness is, well... uncompromising.

Re:The Last Hope for Scala's Infinity War [video] by the_af on Wednesday July 11, 2018 @06:05PM (#17510639)
If I understood the talk correctly, except for the OOP+FP part, DeGoes seems to be arguing out of practicality, not correctness. He correctly argues, for example, that "FP + OOP in a concise language" is irrelevant as a marketing/business speech for Scala. He seemed to me to actually want to make those compromises and engineering decisions you mention, while maybe admitting that the existing ones are not as successful as initially hoped for.
Re:The Last Hope for Scala's Infinity War [video] by cageface on Wednesday July 11, 2018 @06:02PM (#17510619)
This is exactly what drove me out of the lisp community. There are just too many people that insist on seeing engineering decisions between different sets of trade offs as stark choices between good and evil. Go read some of Eric Naggum’s rants for a really extreme example of this syndrome.
Re:The Last Hope for Scala's Infinity War [video] by fjsolwmv on Wednesday July 11, 2018 @07:25PM (#17511041)
Eric Naggum was one loud extremist. He wasn't the community, but he was so loud and rude (which unfortunately entertains people) that he was was what people thought the community was.
Re:The Last Hope for Scala's Infinity War [video] by kazinator on Thursday July 12, 2018 @02:34PM (#17517347)
"The Lisp community" is purely an imaginary construct that only exists because you want it to.

"Community" is largely a toxic concept anyway.

Oh, we have to have a community. Community this, community that. Nice project, but where is your community? I can't write a line of code without a community!

Tired of "community".

Re:The Last Hope for Scala's Infinity War [video] by cageface on Friday July 13, 2018 @12:06AM (#17520451)
Nice to see that nothing has changed.
Re:The Last Hope for Scala's Infinity War [video] by kazinator on Friday July 13, 2018 @09:23AM (#17522705)
You're still seething with hostility with regard to the conditions of a Usenet newsgroup fifteen years ago that is only very lightly active now. Reddit has r/Lisp which is more active and very different from old c.l.l. (Not that it's reasonable to equate r/Lisp with "Lisp community", either.)
Re:The Last Hope for Scala's Infinity War [video] by cageface on Saturday July 14, 2018 @03:00AM (#17529195)
No seething or hostility here. I learned a lot from Lisp.
Re:The Last Hope for Scala's Infinity War [video] by eecc on Wednesday July 11, 2018 @05:52PM (#17510573)
Partial functions are undefined outside of the part that is given, therefore the result of an input that falls in that zone is undefined. This is not good, how do you deal with it, exceptions? Termination? You must make the function total by extending it to a version that gives some result to manipulate whatever the input (or restrict the domain to make it again total.)
Re:The Last Hope for Scala's Infinity War [video] by tunesmith on Wednesday July 11, 2018 @06:36PM (#17510797)
So the idea would be to allow currying, but not allow partial application of the currying?
Re:The Last Hope for Scala's Infinity War [video] by philipkglass on Wednesday July 11, 2018 @06:47PM (#17510840)
Partial application of functions is fine. Partial functions would be disallowed.

Here's a function that is only partial, because it can throw an exception instead of returning a value when b is zero:

def divide(a: Int, b: Int): Int = a / b

Here's a total function to accomplish the same basic goal:

def divide(a: Int, b: Int): Try[Int] = Try(a / b)

This function always returns a value of the type it's declared to return.

Re:The Last Hope for Scala's Infinity War [video] by tunesmith on Wednesday July 11, 2018 @07:31PM (#17511067)
Thanks for that clarification. I had googled for "partial function vs currying", which led me to results for "partial function application", which was really about partial application of functions, not partial functions. :-/

I swear, probably 80% of my problems in professional life are from overloaded terms.

Re:The Last Hope for Scala's Infinity War [video] by AnimalMuppet on Wednesday July 11, 2018 @08:10PM (#17511239)
By "overloaded", do you mean "having multiple definitions"? Or do you mean "carrying too much weight"?

;-)

Re:The Last Hope for Scala's Infinity War [video] by dllthomas on Thursday July 12, 2018 @12:18PM (#17516046)
> Partial functions would be disallowed.

Some partial functions would be disallowed, assuming you aren't including an actual totality check (which would exclude all partial functions and some total ones).

Re:The Last Hope for Scala's Infinity War [video] by eecc on Thursday July 12, 2018 @02:09AM (#17512519)
Currying always returns another function (if I’m not mistaken it doesn’t even evaluate anything yet) so it’s another thing and the compiler has a complete understanding of what will happen at runtime. With a partial it won’t be able to do that. The later comment with the Try[] is a great example