Live data from Hacker News

Hands-on Scala Programming

handsonscala.com

61–70 of 108 posts

Re: Hands-on Scala Programming

#61
post #40

Earlier quoted context omitted.

Neither is cats in Scala. Most Scala programmers are probably just maintaining Play apps or using Apache Spark, with no pure FP in sight. The pure FP contingent is just very active and vocal online.

Unfortunately like you say the pure FP crowd are extremely vocal online and that seeps into the culture of any company that uses Scala. Most of the visible members of the community value and advocate for fp purity and 100% type-safety at any cost, and that has a large effect on who gets attracted to learn Scala in the first place, what they consider to be good or bad code, etc. The resulting culture of firms using Sc…

I agree with your evaluation that parts of the FP community are extremely vocal and extremely smug, and this can and does have a bad effect on a community. This is a problem. Dealing with this problem requires leadership. In particular a project leader typically has to decide (in a Scala context) whether to go FP or imperative, because mixing both is often a problem. Similar to e.g. using message passing or shared memory for communication between threads.

    throw exception 
This is a good example. It is really important to be very clear from Day 1 how to handle errors in a project. One hybrid choice that is popular is: use exceptions for errors that you cannot recover from, use Options for local error handling.

Re: Hands-on Scala Programming

#63

I work JavaScript/TypeScript day to day, but I like Python syntax and easiness but also like Go's concurrency. Having learned Haskell and Rust in the past, these days I appreciate simpler language. In what way does Scala have Python's convenience and Go's concurrency? Based on talking to a few people that used Scala in the past they said they wouldn't use it again and they said I probably wouldn't like it.

I stand corrected.

Re: Hands-on Scala Programming

#64
post #54

Earlier quoted context omitted.

Looks like Scala instead of OCaml is in my next language to learn.

You should! Been coding in Scala in my day job for the past 5 years, and it’s a great language - my personal favourite. Elegant/beautiful AND practical. The mix of OOP, FP, really robust static type system, and great 1st class concurrency support is a direction most languages are moving in, and Scala already nails it. There’s a significant learning/ramp-up period, but it’s good learning that helps your programming in…

I agree. I've used both heavily, they are both amazing, but Scala nowadays has a much richer ecosystem of libraries (because of the JVM heritage). Nevertheless, they are both in the ML tradition of languages, and once you've mastered on, the other is easily picked up.

Re: Hands-on Scala Programming

#65

I guess this question pops up every time… what are some good reasons to choose Scala over Haskell or F# if you are interested in the FP part of Scala?

When you’re choosing Scala you have all the perks of JVM platform. You can reuse Java libraries if needed. Scala has pretty powerful type system. JVM in turn is a pretty good platform, with decades of effort, which can tolerate high load, make different optimizations in runtime, tolerate large heaps if needed, GC story in Haskell runtime is not even close to JVM.

Re: Hands-on Scala Programming

#66
Honestly interested to know: Is there any added value for a Python developer in learning and using Scala? I love Python, especially because of its ecosystem, its widespreadedness, and of course because of Pandas, Numpy, Matplotlib. But I miss functional constructs from Mathematica or Scheme. Scala seems to be much more systematic and profound, but again: For everyday usage, is it overkill?

Re: Hands-on Scala Programming

#68
post #63

I work JavaScript/TypeScript day to day, but I like Python syntax and easiness but also like Go's concurrency. Having learned Haskell and Rust in the past, these days I appreciate simpler language. In what way does Scala have Python's convenience and Go's concurrency? Based on talking to a few people that used Scala in the past they said they wouldn't use it again and they said I probably wouldn't like it.

I stand corrected.

> So you think, hey! I get to use scala.util.Random in javascript instead of javascript's shitty Math.random() ! Woah! That is so beyond awesome.

What? You can certainly use scala.util.Random from scala.js, there are very few Scala features that Scala.js does not actually support, such as blocking (because javascript) and reflection.

> Because this is the scala api that the scalajs folks expose - https://www.scala-js.org/api/scalajs-stubs/latest/#scala.pac.... . So that's fewer than 70 types.

That's not everything that's available in Scala.js, those are just some stubs for smooth cross compiling.

---

Scala.js is certainly not for every project. It's not a better typescript than typescript is. But typescript also isn't the right tool for every project.

Re: Hands-on Scala Programming

#69
post #66

Honestly interested to know: Is there any added value for a Python developer in learning and using Scala? I love Python, especially because of its ecosystem, its widespreadedness, and of course because of Pandas, Numpy, Matplotlib. But I miss functional constructs from Mathematica or Scheme. Scala seems to be much more systematic and profound, but again: For everyday usage, is it overkill?

I cannot answer your question. Since you love Python, I guess you don't have any problem with dynamic type-checking. You also mentioned Scheme, I take that as you don't mind parentheses either. :)

If you would like to try something that's closest to Scheme and has access to the rich libraries in both the Python and Java ecosystems, give Clojure a try. You have access to the Java libraries out of the box and, with libpython-clj [1], you get access to your familiar Python libraries.

[1] https://github.com/clj-python/libpython-clj

Re: Hands-on Scala Programming

#70
post #42
post #24

Some context for people who have limited knowledge of Scala. Lihaoyi is one of the most prolific coder's, not just in Scala, but in any language. He looks like he is much to humble and modest to claim so himself, so I will do it for him. Here is a by no means exhaustive list of projects - A buildtool - A bash replacement that speaks Scala - A test framework - A parsing library - Ports of several python libraries in S…

I think your argument here is counterproductive. Lihaoyi is a prolific coder but most coder like me are average Joe. How can Scala be useful and make average Joe like me productive. The fact that Lihaoyi is a prolific coder in any language does not help selling Scala.

Haoyi makes libraries that are very easy to use, modelling them after popular Python libraries. If you're interested he recently wrote a long blog about the future of Scala being exactly this approach; make easy to use libraries for people like yourself interested in being productive in Scala quickly. https://www.lihaoyi.com/post/TheDeathofHypeWhatsNextforScala...
Post reply on HN