Live data from Hacker News

Scala – 1 Star – Would Not Program Again

overwatering.org

31–40 of 324 posts

Re: Scala – 1 Star – Would Not Program Again

#32
post #18

Earlier quoted context omitted.

Is Grails as good as they say it is?

I think it may be but I came to the Java ecosystem to escape RoR.... it seems we should be able to do better than emulating Rails minus the existing gem community, no? I have much more faith in the JVM but would like to see it provide a step beyond Rails rather than catching up. Play is nice because it is trying to accomplish this with Akka, though yes I see there are other issues. As mentioned in another comment, I'…

Have you tried Pedestal or Luminus?

Re: Scala – 1 Star – Would Not Program Again

#33

I think Scala is great as long as you stay on the road and not end up in the deep depths of academic hell (i.e. http://blogs.atlassian.com/2013/01/covariance-and-contravari... ). I should say one thing however: I'm using Scala because of Akka. An extremely powerful library that does a good job of hiding the complexities while still allowing you to be flexible.

That's a gratuitously category-theoretic explanation, all you need to explain covariance and contravariance is is-a.

An immutable List of Foos is a List of Bars if a Foo is a Bar. A function taking X and returning Y is a function taking A and returning B if A is a X and Y is a B.

It's just answering the question "Can I use type relationships to guarantee that I will have no run-time conversion failures?"

Re: Scala – 1 Star – Would Not Program Again

#35
post #33

I think Scala is great as long as you stay on the road and not end up in the deep depths of academic hell (i.e. http://blogs.atlassian.com/2013/01/covariance-and-contravari... ). I should say one thing however: I'm using Scala because of Akka. An extremely powerful library that does a good job of hiding the complexities while still allowing you to be flexible.

That's a gratuitously category-theoretic explanation, all you need to explain covariance and contravariance is is-a. An immutable List of Foos is a List of Bars if a Foo is a Bar. A function taking X and returning Y is a function taking A and returning B if A is a X and Y is a B. It's just answering the question "Can I use type relationships to guarantee that I will have no run-time conversion failures?"

[deleted]

Re: Scala – 1 Star – Would Not Program Again

#36
post #3

As a java Dev I have been watching Scala to see what people make of it. It seems like Scala is generally perceived as an academic exercise. We all want more powerful tools and infinite expression but at what point are we bikeshedding languages instead of building transparently clear solutions? Scala seems to be solving problems i dont have.

It seems more to me to be an academic exercise in compiler complexity that has been wrapped in a shell of "lookit! Java++" as a play for industry acceptance. I haven't been working with it for long, but I feel that there's a lot of interesting stuff that has become unusably complex because of the design decision to support toll-free Java interop. That makes me nervous.

Re: Scala – 1 Star – Would Not Program Again

#37
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 the standard practice of stringly typed headers and is using strongly typed headers.

> ... and even types for every ‘known’ HTTP header.

> The known HTTP header part was particularly ridiculous. HTTP headers are defined as simple key/value pairs. You’re supposed to be allowed to add arbitrary headers. You’re not supposed to be constrained by the framework you’re using not having any support for CORS yet.

He has taken a strong position against this strong typing; I take a similarly strong position for such strong typing.

Yes, HTTP headers are defined as simple key/value pairs. But headers are not text; they are data. XML is defined as text. Should we use regular expressions to work with it? (True, it also has the DOM defined. But HTTP headers also have a grammar defined—it just happens to include the admissibility of extension headers.)

HTTP is a serialisation format for messages; messages made up of computer-readable data, not text.

I wrote a handful of paragraphs about this subject at https://github.com/chris-morgan/rust-http/issues/1 where using a map instead of typed headers was suggested.

As I also note there, I would not attempt such a scheme in a language like Python (my primary language for some years) because its type system is not well adjusted to something like this; I am certain it would cause many problems and feel it likely it would cause more than it solved. But in a language with a solid type system capable of expressing these things, taking advantage of it should lead to a faster, more correct program.

In the end, I believe strongly typed headers are a good thing to have (it will actually make most code distinctly nicer—e.g. ``response.headers.date = Some(now())`` instead of ``response.headers.set("Date", now().to_http_header())``). The implementation of the scheme in rust-http is certainly not perfect yet; I'm not happy with it at present; I'm expecting to turn the extension headers into a trait object, and I've even considered crazy ideas like allowing users of the library to make their own header collection (request.headers and response.headers) types—that would allow custom headers to be made first-class citizens but could lead to compatibility problems.

Still, I don't want to make something that I believe should be the best HTTP library around and find that people hate to use it. What do you think about this header matter?

Re: Scala – 1 Star – Would Not Program Again

#38
post #8
post #6

Earlier quoted context omitted.

How does that actually work? Does that "type" basically compile down to an added n != 0 check at runtime, or is there more sophisticated dataflow analysis/theorem proving going on?

Usually it enforces statically that you cannot create an Integer that violates its preconditions. If you even do so dynamically it'll make sure there's a dynamic check before the dynamic value can substantiate the more specific type.

It is done statically. Types are a compile time construct, languages like Agda and Coq have no type information at runtime. This means if one can't statically prove that their types are correct the code won't compile.

For example if my function returns a Vector[A, N] (a vector of A's with size N), and I try to pass it's return value to a function that expects a of type Vector[A, 2] my code will not compile. This is because there is no way one can prove forall A N. Vector[A, N] satisfies Vector[A, 2].

Re: Scala – 1 Star – Would Not Program Again

#39
post #7

Just shut up and use Java. It's fine.

After using Haskell, using Java makes me very sad...

In Java's OO paradigm, instance variables are inherently defined separately from their initialization, making it quite difficult to make sure they're always used when initialized, properly.

The nullability stuff bites me over and over :(

Forgetting to use .start() on a thread is a stupid runtime error, instead of using some design where it isn't possible to forget .start() or at least get a compile-time error.

I am also using a lot of C in parallel, and with the C preprocessor, I am finding that C is often more expressive and nicer to use than Java!

Everything takes ridiculous amounts of code.

For example, in Haskell, I can write:

  threadIds 
To get a thread-pool of 10 threads looping around my code, and put their thread ids in a variable.

In Java, this requires so much effort!

Not to mention the utter lack of sum types and pattern-matching, making tons of Java code that looks like:

  if(msg.what == Foo) {
    msg.obj1 ...
    msg.obj2 ...
  } else if(msg.what == Bar) {
    ..
  }
arrrg!

Re: Scala – 1 Star – Would Not Program Again

#40

I started learning Scala almost a year ago at my latest job - we use it for production systems at a large multinational investment bank. Coming to Scala from experience including C, Java and Haskell, I intially found Scala quite difficult. It is true that there are some things in Scala that are not obvious to newcomers, and that are difficult to discover for yourself - such as the use of Implicits, and the strange pr…

I agree with everything above. At Vonjour we use Scala. From a business standpoint, our only reluctance was that hiring was going to be more difficult. However, we have received higher quality candidates that are eager to learn applying for our positions.
Post reply on HN