Earlier quoted context omitted.
Spring supports everything that helps their bottom line. Where are the Groovy, Scala, Clojure support nowadays?
Groovy is still alive within the context of Grails (which is basically a very nice wrapper around Spring) and Micronaut (which is a direct competitor to Spring). Micronaut officially supports Java and Kotlin as well.
Scala 3.0.0-M1
81–90 of 148 posts
Re: Scala 3.0.0-M1
#82Earlier quoted context omitted.
There are no "special" methods in Scala. If you see something like "arr.map(_.nonEmpty).filter(a => a % 2)" in the standard library, you can use that syntax yourself too. E.g. "arr.customlyFiltered()" is easy to do. Or even easier "arr.filter(myCustomFilter)". If something doesn't work out for you, please feel free to use e.g. scalafiddle.io and make it example, then you will be helped! :) Scala is indeed not a high…
There is no straighforward elegant way of doing "obj.scalaMethod.myCustomMethod.scalaMethod.myCustomMethod" in Scala. I want to create a method and just inject it into the chain, no fiddling or ducktaping or using some black Scala magic. "def myFun(a: String, b: Double): Boolean = {...}" and then "obj.mapValues.myFun.forall(_)" or just anything similar. And yes, Scala is exactly the language when you need safe and ma…
And it will be even easier in Scala 3, where this pattern is coded into an even simpler feature: extensions.
Re: Scala 3.0.0-M1
#83Earlier quoted context omitted.
How is that a bad thing? It's the same in other languages and it is nice to have some flexibility. E.g. lisp: use whichever type of parentheses you want Or Kotlin: use short syntax lambdas fruits.filter(it == apple) or long syntax fruits.filter(fruit -> fruit == apple) or with annotated types: fruits.filter{fruit: Fruit -> fruit == apple} Sometimes brevity is good for the reader, sometimes more details are good for t…
> How is that a bad thing? This doesn't quite answer your question, but, the Python community takes seriously the idea of There's Only One Way To Do It , as part of their philosophy on complexity. https://wiki.python.org/moin/TOOWTDI https://www.python.org/dev/peps/pep-0020/
But is python really so good? I'm not a heavy python user, but there are loops and list comprehensions and map. There are also optional type annotations now, should you always use them, or not? How about "a is b" or "a != b"? How about environments and build tools...
I think that go might have been a better model student.
Re: Scala 3.0.0-M1
#84In my company (10k+ devs) Scala seems to be losing steam. All the enthusiasts have moved to Go/Rust, while the pragmatics are staying in (moving back) in Java. No new major project is being built in Scala. Does anyone share this experience?
Re: Scala 3.0.0-M1
#85Earlier quoted context omitted.
There is no straighforward elegant way of doing "obj.scalaMethod.myCustomMethod.scalaMethod.myCustomMethod" in Scala. I want to create a method and just inject it into the chain, no fiddling or ducktaping or using some black Scala magic. "def myFun(a: String, b: Double): Boolean = {...}" and then "obj.mapValues.myFun.forall(_)" or just anything similar. And yes, Scala is exactly the language when you need safe and ma…
It's not really black magic https://docs.scala-lang.org/overviews/core/implicit-classes.... but I don't really see why having a filter as a method should even be encouraged.
This was just an example. It's not about filter at all but the general method chaining.
Here is example from D if I must:
real[] fun(int[] arr) {
return arr.map!(a => a.to!double / PI).array;
}
void main()
{
int[] arr = 100.iota.array; // [0, 1, 2, 3, ...]
real[] newArr = arr.map!(a=> a*2).array.fun); // [0, 0.63662, 1.27324, ...]
}
I don't know how you can chain a custom method "fun" to the output of the "map" in Scala without duck typing. Why is this not possible when all conditions type-wise are met? Why you can chain std methods like map, filter, reduce, fold etc. but not custom ones?Re: Scala 3.0.0-M1
#86Earlier quoted context omitted.
For me scala's feature set is absurdly big and there are always 10 ways todo things. Look at the spec of Scala. Its 200 pages long. That's insane. I'd rather use Kotlin.
This is like saying, airplanes are too complex. There are so many knobs and buttons. I'd rather just walk or ride a bike everywhere. Scala is a very powerful, very expressive language. There are some features which you can just choose to leave out. If you do, you end up with a very clean, concise, and powerful language that makes you really productive. I've literally had moments where I made my algorithm 5x faster ju…
Re: Scala 3.0.0-M1
#87Earlier quoted context omitted.
It's not really black magic https://docs.scala-lang.org/overviews/core/implicit-classes.... but I don't really see why having a filter as a method should even be encouraged.
Implicits are not encouraged in our code base and for a good reason. This was just an example. It's not about filter at all but the general method chaining. Here is example from D if I must: real[] fun(int[] arr) { return arr.map!(a => a.to!double / PI).array; } void main() { int[] arr = 100.iota.array; // [0, 1, 2, 3, ...] real[] newArr = arr.map!(a=> a*2).array.fun); // [0, 0.63662, 1.27324, ...] } I don't know how…
// Need to define this once somewhere in your project
implicit class TrushExtension[A](anything: A) {
def |>[B](function: A => B) = function(anything)
}
// Your application code
def fun(arr: Iterable[Int]) = arr.map(_.toDouble / Math.PI)
val arr = 0 to 100
val newArr = arr.map(_*2) |> fun
newArr.foreach(println) // prints 0, 0.63662, 1.27324, ...
Execute or change the code here: https://scalafiddle.io/sf/WAKhZtJ/0This is maybe not exactly as convenient, but it comes pretty close.
"someA.someB.someC" becomes "someA |> someB |> someC".
Re: Scala 3.0.0-M1
#88Earlier quoted context omitted.
Implicits are not encouraged in our code base and for a good reason. This was just an example. It's not about filter at all but the general method chaining. Here is example from D if I must: real[] fun(int[] arr) { return arr.map!(a => a.to!double / PI).array; } void main() { int[] arr = 100.iota.array; // [0, 1, 2, 3, ...] real[] newArr = arr.map!(a=> a*2).array.fun); // [0, 0.63662, 1.27324, ...] } I don't know how…
Ah, I understand what you mean now. You are looking indeed for the thrush operator. I think it should be built into Scala's standard library, but until that happens, you can use the mouse library or build it yourself. Here is an example: // Need to define this once somewhere in your project implicit class TrushExtension[A](anything: A) { def |>[B](function: A => B) = function(anything) } // Your application code def…
Re: Scala 3.0.0-M1
#89Earlier quoted context omitted.
Have you used Scala before? I used both perl and Scala and I had to laugh when I read what you said. Yeah, Scala makes it possible to write cryptic DSLs. I just don't use libraries that do that, but there are not many such libraries anymore anyways, that was mostly abused in the early days of Scala. Now, 15 years later, that's almost non-existing anymore. But not having symbolic characters in method names is just hor…
"I just don't use libraries that do that" -- sounds like you found a solution :) I agree that "+" looks better than ".plus" but this is a matter of taste (hello Ada). Yes, I use Scala at work but I can't call myself a seasoned Scala dev, true. On the other hand, just every expert in this or that language will always have a counterargument for you and a solution to the problem. Because he IS an expert! The thing is, n…
And yeah, you are totally right. Most people indeed choose the way of the least resistance and don't want to spend much time learning a language - for good reasons. Scala will never be as popular as Python or Javascript. It is a language for people that are ready to invest more time and dedication to get a higher productivity after some time. Not everyone wants to do that and many people find it too hard. I think the Scala community knows that. :)
Re: Scala 3.0.0-M1
#90In my company (10k+ devs) Scala seems to be losing steam. All the enthusiasts have moved to Go/Rust, while the pragmatics are staying in (moving back) in Java. No new major project is being built in Scala. Does anyone share this experience?