Live data from Hacker News

Scala – 1 Star – Would Not Program Again

overwatering.org

231–240 of 324 posts

Re: Scala – 1 Star – Would Not Program Again

#231
post #91

Earlier quoted context omitted.

Not all things are statically checkable. If you want to take in some runtime data and treat it as a Vector[A, 3] then you'll need to include a dynamically failing check like (List -> Maybe (Vector n a)).

I don't know Agda or Coq but I assume all it would take is to test the size and throw a runtime error for it to statically assert that it is the correct size after the test. Now the compiler is helping you write the runtime preconditions checks and handling that you should be writing anyway.

Yeah, that's exactly how dynamic data can enter a statically typed regime of code. Dependent types make it so that it's impossible to bring dynamic data into type-controlled parts of your code without first performing and passing those tests.

Which seems weak since smart developers should do that anyway, but (a) there's still some divide between "should" and "it's impossible" and (b) this is just the tip of the iceberg about what dependent types offer anyway.

Re: Scala – 1 Star – Would Not Program Again

#232
post #187

Earlier quoted context omitted.

Scala reminds me of C++ too, but it's impressive that, in a mere 10 years, Scala has achieved all the multi-paradigm incoherence it took C++ 30 years and tortuous backwards compatibility constraints to attain. Actually, I spent some time over the weekend trying to get familiar with Scala by using it to solve some Project Euler problems, and it was pretty entertaining. Still, the language's bias towards there being mo…

http://docs.scala-lang.org/style/

Thanks, that's really useful. It answers a lot of the irritating little questions that Scala's flexible syntax gives you, like whether or not to use dots for method invocation. I see that Twitter has a document on the best ways to write Scala, which looks interesting: http://twitter.github.io/effectivescala/

Re: Scala – 1 Star – Would Not Program Again

#233
post #202

Earlier quoted context omitted.

Hobby wise: Haskell, Rust, Nimrod, Haxe Shipping code: Go, Erlang, C++11 (avoiding legacy), F# (with Xamarin) I program in many more, but those are probably my top 8 right now.

You never work with scripting languages? (i.e., why is there no Python, Ruby or Javascript in your lists? or maybe I do'nt know Haxe, does that replace them?)

I'm not them, but I have no scripting language in my list either. There is simply no need for one. For small sysadmin scripting, sh is nicer than a scripting language. For anything bigger than ~50 lines, I use haskell.

Re: Scala – 1 Star – Would Not Program Again

#234
post #201

Earlier quoted context omitted.

It 'looks just like Scala'? It is not even a functional programming language. Let alone that it supports implicits, general operator overloading (operator overloading is very limited in Kotlin), existential types, etc. In fact Kotlin looks mostly like Java with some additions to make everyone's lives easier (closures, extension methods, data classes).

Kotlin is certainly in the "Java philosophy" camp (alongside Go, Dart), and yet achieves most if not all of Scala's original goals (though, unlike Scala, it is not a superset of Haskell, Lisp, Javascript and Java, so if you want to write Lisp, Haskell and Javascript, and insist on having all three compiled by the same compiler, you should stick with Scala :)). I have high hopes for Kotlin, and can certainly see my fu…

>though, unlike Scala, it is not a superset of Haskell, Lisp, Javascript and Java

If you think scala is a superset of those, then you either really don't know scala at all, or you have an incredibly low opinion of all the languages you listed.

Re: Scala – 1 Star – Would Not Program Again

#235
post #201

Earlier quoted context omitted.

Kotlin is certainly in the "Java philosophy" camp (alongside Go, Dart), and yet achieves most if not all of Scala's original goals (though, unlike Scala, it is not a superset of Haskell, Lisp, Javascript and Java, so if you want to write Lisp, Haskell and Javascript, and insist on having all three compiled by the same compiler, you should stick with Scala :)). I have high hopes for Kotlin, and can certainly see my fu…

I think I read that phrase from you before on nyc. I think it's a misleading catchprase. For me and I think most other Scala devs Scala is a statically typed FP-OO language. So Haskell doesn't do it justice because Haskells insistence on purity makes it impractical for me in getting stuff done. And Java doesn't do it justice because Java is held back by its history. "Superset of" makes it sounds like a weakness and o…

>So Haskell doesn't do it justice because Haskells insistence on purity makes it impractical for me in getting stuff done

I know this will sound snarky, but I have to ask: have you tried haskell before? I only ever hear that line of reasoning from people who have never used it (and I was once one of them, using that very same reasoning to choose a multi-paradigm language). We bailed on scala for haskell precisely because it is pure and has a better type system.

Re: Scala – 1 Star – Would Not Program Again

#236
post #188

Earlier quoted context omitted.

For thread pools, use ExecutorService or the Guava flavour. The lack of pattern-matching is a pain, but note that you can use Enum values in switch statements.

As is often the case, writing the code from scratch in Haskell is easier than reusing a library in Java.. Android uses named integers rather than enums, due to some issue with Java enums.. And the switch would only help a bit, the main problem is needing to correctly interpret the associated payload according to the message type. That's what sum types give you, which Java doesn't properly have. They could be emulated…

I never understood why Java didn't go to proper sum types when it introduced enums. They all have to have the same shape, just distinguished by their method implementations, same as always in OO. What kind mechanism for describing alternatives is that?

Re: Scala – 1 Star – Would Not Program Again

#237
post #2

I like Scala. It's a JVM language, it's extremely powerful, but maybe it's too powerful for us mere mortals. Eclipse allows very fast compilation times, but when I tried sbt, I gave up because I CAN'T wait for compilation: we're in 2013, I'm using a quad core at 3.4GHz, 12GB of RAM and SSD, so I'm not ready to wait. Eclipse allows fast incremental compilation. Scala's type system is very rich. I don't know if there e…

> I don't know if there exists any type that can't be expressed in Scala. Scala has a very rich type system, but let us not get ahead of ourselves--Scala, being non-dependently typed, cannot type many useful programs. For an example of a useful dependent type, consider giving division the type Number -> {x : Number | x != 0} -> Number. Giving division the type Number -> Number -> Number is similar to how older Javas…

You can use pattern matching with custom extractors to define partial functions only accepting positive numbers.

object Positive { def unapply(x: Int): Option[Int] = if (x>0) Some(x) else None }

val onlyPositive: PartialFunction[Int, String] = { case Positive(x) => s"check out this positive number: $x" }

This would throw a MatchError for non-positive Ints, but you can also handle the failure case like so:

def onlyPositive(n: Int) = n match { case Positive(x) => s"check out this positive number: $x" case _ => s"not a positive number: $n" }

This is a quick example, but in practice the lack of dependent types is not a huge handicap.

Re: Scala – 1 Star – Would Not Program Again

#238
post #82

The section on HTTP headers and typing is a little concerning to me. I've been making rust-http recently and (before I was aware of Spray) I felt strongly about the typing. So, I'd like to discuss this. Am I wrong after all? Here clearly is someone that disagrees with me. I think I should probably write up a long blog post on the topic explaining my reasoning and so forth. rust-http is, at present at least, rejecting…

But what practical problem is such a scheme actually solving? If I write response["headre"] = ... I have a bug, sure, but an obvious bug that will be fixed very quickly. With this type system I am now limited in an annoying way. I don't get it.

>I have a bug, sure, but an obvious bug that will be fixed very quickly

I love that there are people who say things like this totally seriously.

Re: Scala – 1 Star – Would Not Program Again

#239
post #233
post #202

Earlier quoted context omitted.

You never work with scripting languages? (i.e., why is there no Python, Ruby or Javascript in your lists? or maybe I do'nt know Haxe, does that replace them?)

I'm not them, but I have no scripting language in my list either. There is simply no need for one. For small sysadmin scripting, sh is nicer than a scripting language. For anything bigger than ~50 lines, I use haskell.

Fair enough, but sh is a scripting language also :)

Re: Scala – 1 Star – Would Not Program Again

#240

Earlier quoted context omitted.

4GL and MUMPS? Sounds like you've spent a bit of time in the dark corners of the healthcare industry. My condolences.

Indeed, DEEP in the east coast systems. But, it was great for me, it was literally name my own price consulting (lawyer rates) with multi-month contracts. I would guess it still is a name your own price market if you have the stomach for it. Travel and horrible tech. I was in an odd position of having picked up 4GL and MUMPS via odd random ways when I was 19/20 -- so when everyone who used to maintain those systems v…

I had a brief but fascinating encounter with MUMPS back in the late 80's on some ancient Data General Nova/Eclipse kit. I kinda wish I'd persevered, if only for minting cash for the bank account.
Post reply on HN