Live data from Hacker News

Scala 3.0

github.com

241–250 of 292 posts

Re: Scala 3.0

#241
post #230

Earlier quoted context omitted.

Ok, it's perhaps a true Scotsman argument but saying that Java as a syntax for ADT is like saying JS (pre 2015) has classes because it can be simulated by function + prototype or that Java (pre 8) has lambdas because it can be simulated by anonymous classes. Java misses the syntactic sugar to define ADT in one place like in Standard ML, OCaml or F#. The closest you get is to declare records inside a sealed interface,…

> Java misses the syntactic sugar to define ADT in one place like in Standard ML, OCaml or F#. I don't think so. > I was not able to define a classical list with cons and nil in Java. If you want to restrict Nil to a single instance, don't make it a record class: sealed interface List { static List cons(T car, List cdr) { return new Cons (car, cdr); } static List nil() { return (List )Nil.INSTANCE; } record Cons (T c…

Pattern matching does not work if you use an enum

  List list = cons("a", nil());
  switch(list) {
    case Cons(var car, var cdr) -> ...
    case Nil -> ...
  }
Nil is typed List which is not compatible with List.

You may be able to use extractors as the inverse of the static methods cons() and nil() but that adds more boilerplate.

Disjunctive enums like in Rust or Scala 3 is a simpler way to define ADT.

Re: Scala 3.0

#242

Personally I'm looking forward to scala native 1.0 more than anything else. We'll have a strong Haskell competitor. I dont like jvm.

How is current Scala not actually a Haskell competitor today? Superficial dislike of a VM isn't a valid reason.

Haskell's runtime is just better for pure FP than the JVM. GHC's optimizations and general TCO go a long way.

Re: Scala 3.0

#243
post #182

Earlier quoted context omitted.

Wat? How is the recent trajectory disastrous?

To take Loom as an example.. The primary problem with threads isn't their performance, but the way that they encourage bugs and race conditions by decoupling data access from flow control. They're fine as a low-level API for implementing a more usable API, but not as the primary API that you expect application developers to use.

This seems to be more of a Java problem, not a JVM problem.

Re: Scala 3.0

#244
post #88

This is super cool! Looking forward to metaprogramming in Scala 3!

Choose your flavor @ https://docs.scala-lang.org/scala3/guides/macros/

This looks a little like inline in F# where it allows more generic method cases than standard generics do in C#/Java. Looking at the documentation I'm wondering does it allow things like - "any input type that supports the divide operator"? It's a feature I've appreciated previously when writing high performance math code on the .NET side.

Re: Scala 3.0

#245
post #117

Earlier quoted context omitted.

I wouldn't jump on the Scala 3 ship just yet. Maybe if mostly a learning project but not for an important part. Whilst it was not a surprise release there will be long time until a majority of the libraries and frameworks will also work with it. The big ones are mostly there, but there are lots of smaller ones that are not and there will be teething problems, even after a long alpha-beta-rc train. Scala 2.13 is still…

Looks like many libs already support Scala3: https://index.scala-lang.org/search?targetTypes=jvm&scalaVer...

Not sure what Play Framework is doing at the top of the list, will most likely be many months before a Scala 3 supported version is released.

Same for Spark, DB libraries, Akka, etc. Basically everything with large dependency graphs that depend on macros or removed Scala 2 features (e.g. abstract type projections, arghhhh) will take significant time to port over to Scala 3.

What has had Scala 3 support from early on in the release cycle are the FP/Typelevel projects, which are obsessively maintained by the I'll-sleep-when-I'm-dead FP crowd.

Re: Scala 3.0

#246
post #224

Earlier quoted context omitted.

There's some weird history there. For most of the project's existence, Scala 3 was known as Dotty. It was basically a research project, and it was recognized from the beginning that it was a different language than Scala, largely due to the type system semantics...the goal being a formally defined, fully sound type system (Scala had some edge cases that made it not sound, even if it was more sound than most languages…

Not sure that's correct. I remember going to a talk around 2013 with Odersky and got the impression that dotty would be the future scala.

Looked it up, the official announcement that it would become Scala 3 happened in 2018.

https://www.scala-lang.org/blog/2018/04/19/scala-3.html

You can dig through the git history of the readme for Dotty, it's actually pretty enlightening how Odersky's perception of it has evolved over time. For example, in 2014 he referred to dotty as an experimental compiler for a dialect of scala.

https://github.com/lampepfl/dotty/commit/6a42d32181bd7b8639f...

Re: Scala 3.0

#247
post #224

Earlier quoted context omitted.

Not sure that's correct. I remember going to a talk around 2013 with Odersky and got the impression that dotty would be the future scala.

Looked it up, the official announcement that it would become Scala 3 happened in 2018. https://www.scala-lang.org/blog/2018/04/19/scala-3.html You can dig through the git history of the readme for Dotty, it's actually pretty enlightening how Odersky's perception of it has evolved over time. For example, in 2014 he referred to dotty as an experimental compiler for a dialect of scala. https://github.com/lampepfl/dotty/…

"the work on Dotty over the last 5 years was intended to explore what a new Scala could look like"

Re: Scala 3.0

#248
post #247

Earlier quoted context omitted.

Looked it up, the official announcement that it would become Scala 3 happened in 2018. https://www.scala-lang.org/blog/2018/04/19/scala-3.html You can dig through the git history of the readme for Dotty, it's actually pretty enlightening how Odersky's perception of it has evolved over time. For example, in 2014 he referred to dotty as an experimental compiler for a dialect of scala. https://github.com/lampepfl/dotty/…

"the work on Dotty over the last 5 years was intended to explore what a new Scala could look like"

That doesn't read to you like it was intended to be a new language?

Re: Scala 3.0

#249
post #247

Earlier quoted context omitted.

"the work on Dotty over the last 5 years was intended to explore what a new Scala could look like"

That doesn't read to you like it was intended to be a new language?

I take it to mean a new version of Scala.

Re: Scala 3.0

#250

Earlier quoted context omitted.

I don't believe that this is true. Because, one can just write simple Scala and has pretty much everything that Kotlin has (minus its nullability magic) and never deal with these edgecases. Even compiletimes are decent then. But with Kotlin, it is actually enforced that the more advanced features of Scala are not available, so it makes sure that compiletimes etc. stay short. It also simply reduces the burden of the I…

I love Scala. The thing is as an IDE author you can't just "write simple scala" because you aren't the author, you are the IDE. You have to be able to offer your refactoring tools and other tooling for all of it and cover all the edge cases. LSPs do remove this problem to a large extent though.

I think I understand your posting now - what you are saying is exactly what I mean, but it's of course only true for IDE developers.

And actually, I'm not sure if LSPs help so much. To my knowledge, IntelliJ still uses its own compiler to support the user at least partially of the code is incorrect and doesn't compile.

Post reply on HN