I'd appreciate if anyone has any advices of one vs the other.
Scala 3.0
111–120 of 292 posts
Re: Scala 3.0
#112Earlier quoted context omitted.
I think apart from streams it was Kotlin that did the trick.
Java has not picked up a single feature from Kotlin yet (maybe nullability types someday?), and, in fact, opted for very different ones (e.g. contrast records vs. data classes, virtual threads vs. syntactic couroutines), although I guess Scala has provided some inspiration for some features, as Java's are closer to Scala's than to Kotlin's. ML is probably the biggest influence, with some Haskell flavour. But I find i…
I disagree.
Java records are from Standard ML but sealed is not, it's from Scala with the improvement that subtypes of a sealed types are sealed too.
Java still not have a real syntax for ADT, Standard ML has datatype, Rust or Scala 3 have enums on steroid [1].
Re: Scala 3.0
#113I think the best evolution of a programming language is when some features are removed and replaced by a unifying concept which makes the language both smaller and and more expressive. Has that happened in Scala 3?
[1]: https://dotty.epfl.ch/docs/reference/contextual/motivation.h...
[2]: https://dotty.epfl.ch/docs/reference/dropped-features/macros...
Re: Scala 3.0
#114Looking at the new features. Can anyone say what dependent function types are good for? In the example ( https://dotty.epfl.ch/docs/reference/new-types/dependent-fun... ), what's the difference between: def extractKey(e: Entry): e.Key = e.key and: def extractKey(e: Entry): Entry.Key = e.key // the way I'd normally think of it
So, with:
def process(p: Path, key: p.Key): Something = ???
this will not compile:
val p1: Path = ???
val p2: Path = ???
process(p1, p2.key) <- compile-time-error
Re: Scala 3.0
#115Earlier quoted context omitted.
Java has not picked up a single feature from Kotlin yet (maybe nullability types someday?), and, in fact, opted for very different ones (e.g. contrast records vs. data classes, virtual threads vs. syntactic couroutines), although I guess Scala has provided some inspiration for some features, as Java's are closer to Scala's than to Kotlin's. ML is probably the biggest influence, with some Haskell flavour. But I find i…
> ML is probably the biggest influence I disagree. Java records are from Standard ML but sealed is not, it's from Scala with the improvement that subtypes of a sealed types are sealed too. Java still not have a real syntax for ADT, Standard ML has datatype, Rust or Scala 3 have enums on steroid [1]. [1] https://dotty.epfl.ch/docs/reference/enums/adts.html
sealed interface Expr {}
record ConstantExpr(int i) implements Expr {}
record PlusExpr(Expr a, Expr b) implements Expr {}
record TimesExpr(Expr a, Expr b) implements Expr {}
record NegExpr(Expr e) implements Expr {}
For non-record classes, deconstructing patterns will be something like a dual to methods, and almost a first-class citizen. Among other things, they will allow patterns to support API designs that predate records and sealed types.Re: Scala 3.0
#116Personally I'm looking forward to scala native 1.0 more than anything else. We'll have a strong Haskell competitor. I dont like jvm.
Re: Scala 3.0
#117I'm in need of a functional language for a small part of my system and I'm considering Scala and Purescript[0] (mostly because of their ecosystems). Maybe Scala 3 is a good time to be boarding Scala's ship. I'd appreciate if anyone has any advices of one vs the other. [0] https://www.purescript.org/
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 great.
Re: Scala 3.0
#118Earlier quoted context omitted.
> Scala is not perfect but it’s very good. I like to refer to it as Haskell with an extra chromosome: slow, hard to comprehend, and incredibly strong. I'm lucky enough to write it in my day job and I feel like I'm living life on easy mode because of it. It'd take a lot of money to lure me back to garbage like Python/JS at this point.
> I like to refer to it as Haskell with an extra chromosome: slow, hard to comprehend, and incredibly strong. that's a weird and offensive thing to say
Re: Scala 3.0
#119Can we take a step back now, and reflect on what was the original problem implicits were designed to solve and how it is solved now in Scala 3? I've heard the original problem was that they wanted a chain of functional transformations to return the same type of collection (unlike, say, Clojure or Java 9 which return a Stream).
Re: Scala 3.0
#120Personally I'm looking forward to scala native 1.0 more than anything else. We'll have a strong Haskell competitor. I dont like jvm.