Scala 3 + VS code + worksheets is my favourite exploratory programming environment. Its has: * Powerful functional features * Powerful OO features * Imperative features * Powerful type system * Great stdlib * Great syntax * Very fast write/test cycle with worksheets, way better than a REPL * Great IDE features such as autocomplete Scala may not be the best on any one axis, but the combination is unparalleled.
I don't know what worksheets are, but does Scala3 work with vscode now? Previously the plugins didn't do much, especially if you didn't use SBT.
Scala 3.0
261–270 of 292 posts
Re: Scala 3.0
#262do i still need the jvm?
Re: Scala 3.0
#263What is the best way to get ramped up with Scala 3 for a dev without Scala experience, but strong FP experience.
Re: Scala 3.0
#264Earlier quoted context omitted.
> 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.
Of course, Java could add rules for the special case of zero-argument records, making them more enum-like, but I really think the value in doing that is negative. Other than being able to directly translate ML examples, it would add complexity that isn't worth it.
In fact, in this particular case I'd do it like so:
record List(T car, List cdr) {
public List { if (car == null) throw new IllegalArgumentException("null element"); }
}
Which would give you: switch(list) {
case List(var car, var cdr) -> ...
case null -> ...
}
It might not be exactly what people who like Scala might prefer, but it is very much a good representation of ADTs for those who prefer Java.Re: Scala 3.0
#265Earlier quoted context omitted.
The fact that you can make any instance callable like a function by adding an `apply` method to it isn't just "syntax sugar", it's a pretty fundamental mechanic of FP-OOP fusion that Scala is built around. Same for `unapply`. At any rate none of this "sugar" was a problem to anyone I know who learned Scala. There are harder things about it than learning basic syntax.
It’s a long time since I used scala and none of this was ever a direct problem, but it was all extra complexity. I think there’s a split between people that appreciate sugar and people that find it not worth the additional complexity. That problem does lessen with familiarity, but knowing a lot of complexity makes me wary of unknown complexities. It adds an overhead which takes energy that could be better utilised el…
But Scala's syntax and language features are great when you actually make use of them to accomplish your goals, especially so with Scala 3. The syntax isn't excessive or frivolous or nonintuitive. It's a pretty straightforward encoding of the desired feature set of the language.
Re: Scala 3.0
#266Scala 3 + VS code + worksheets is my favourite exploratory programming environment. Its has: * Powerful functional features * Powerful OO features * Imperative features * Powerful type system * Great stdlib * Great syntax * Very fast write/test cycle with worksheets, way better than a REPL * Great IDE features such as autocomplete Scala may not be the best on any one axis, but the combination is unparalleled.
Can you talk a little more about worksheets? I'm not familiar with scala worsheets at all. Follow-up: How do you transition to productionizing your code after iterating in them?
I tend to not view it as a replacement for an ordinary code file, but as a replacement for a REPL session. It has several advantages:
* Keeping track of your previous commands in a file is much more convenient than keeping track of it in your input history of the REPL.
* You can keep re-editing previous lines easily, and you can see the output of all lines.
* There is no hidden state (unlike a REPL). Everything is run from scratch every time.
* It's easier to define helper functions than in a REPL.
* It's easier to turn a worksheet into a unit test than it is to turn a REPL session into a unit test.
That said, it's also possible to start writing a module in a worksheet, and then turn it into an ordinary code file later.
Worksheets aren't perfect yet; I can think of many improvements, but they're already very useful to me. I think the end game will be to merge the concept of worksheet, unit test, debugger, printf debugging, and ordinary code file into one system, like Sean McDirmid's usable live programming research work (which in my opinion remains one of the most underrated research projects).
Re: Scala 3.0
#267Scala 3 + VS code + worksheets is my favourite exploratory programming environment. Its has: * Powerful functional features * Powerful OO features * Imperative features * Powerful type system * Great stdlib * Great syntax * Very fast write/test cycle with worksheets, way better than a REPL * Great IDE features such as autocomplete Scala may not be the best on any one axis, but the combination is unparalleled.
I don't know what worksheets are, but does Scala3 work with vscode now? Previously the plugins didn't do much, especially if you didn't use SBT.
Re: Scala 3.0
#268Scala 3 + VS code + worksheets is my favourite exploratory programming environment. Its has: * Powerful functional features * Powerful OO features * Imperative features * Powerful type system * Great stdlib * Great syntax * Very fast write/test cycle with worksheets, way better than a REPL * Great IDE features such as autocomplete Scala may not be the best on any one axis, but the combination is unparalleled.
I've been extremely happy with IntelliJ plugin for Scala. I do use Visual Studio Code for Python,JS,web, etc. What would be advantage of using VS Code over IntelliJ for Scala?
Re: Scala 3.0
#269Earlier quoted context omitted.
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…
Re: Scala 3.0
#270Personally I'm looking forward to scala native 1.0 more than anything else. We'll have a strong Haskell competitor. I dont like jvm.
Scala native is not at all needed, you can already leverage graalVM native