Live data from Hacker News

Show HN: Motif – Scala-like pattern matching with Java 8

github.com

31–36 of 36 posts

Re: Show HN: Motif – Scala-like pattern matching with Java 8

#31

Earlier quoted context omitted.

If you've ever endured the compilation time of a Scala codebase that has more than, say, 2000+ classes, then you might think that some things just aren't meant to happen in Scala either. I used Scala for 4+ years at a company that spent a non-trivial amount of time and resources speeding up its Scala builds (way more than 2000+ classes), sometimes doing sadly controversial things[1] to achieve that speedup. It was a…

As a point of reference, compiling ~200 Scala classes at a time would take ~2.5 minutes on average. At my last job, compiling >2000 Java classes took about 10-15 seconds with an ant script doing a top-down build. Unfortunately I don't remember LOC, but I don't remember the average Scala file being overly large at my Scala job, or the average Java file being unusually short at my Java job.

> Unfortunately I don't remember LOC, but I don't remember the average Scala file being overly large at my Scala job, or the average Java file being unusually short at my Java job.

LOC isn't what should count though - there are cases where 1 line of Scala offers functionality that would take 10 or more lines of Java to implement.

Re: Show HN: Motif – Scala-like pattern matching with Java 8

#32

Hard to read in comparison to Scala. It's impressive that it was accomplished but some things just aren't meant to happen in Java 8.

If you've ever endured the compilation time of a Scala codebase that has more than, say, 2000+ classes, then you might think that some things just aren't meant to happen in Scala either. I used Scala for 4+ years at a company that spent a non-trivial amount of time and resources speeding up its Scala builds (way more than 2000+ classes), sometimes doing sadly controversial things[1] to achieve that speedup. It was a…

Scala's compilation time is not an excuse to write ugly hard to maintain code in Java 8. If you don't like Scala compilation time then write Java 8 but keep it idiomatic and easy to read don't drag parts of Scala into it that don't fit.

Re: Show HN: Motif – Scala-like pattern matching with Java 8

#33

Earlier quoted context omitted.

> As a point of reference, compiling ~200 Scala classes at a time would take ~2.5 minutes on average. Odd... I just did a full compile of a Scala project I work on which has: - 259 source files - Contains dozens of macros[1] - Results in 2097 classes (includes companion objects and anonymous types) And it took 75 seconds on my laptop. As I mentioned in another reply, doing a full recompile is rarely needed but was do…

In Java, I compile around 250 classes in about 6 seconds on my laptop. It results in around 250 class files being generated because no filea for anonymous inner classes are created from the lambdas in the code. I don't need a full recompile either. An incremental compile in Java is measured in milliseconds. IntelliJ is usable to its fullest instead of being a fancy editor that just autocompletes and jumps to symbol d…

You have no idea my background, how I use Scala, and assume that the small project I reference is the only project I _could_ reference. It was chosen due to being near the size of the situation you describe as "compiling ~200 Scala classes at a time would take ~2.5 minutes."

Being a condescending asshole doesn't help you communicate with others. Frankly, it strengthens my opinion that you don't know how to organize a medium-sized project, since being able to do so obviates requiring to compile 2000+ files for each build _in any language_.

Re: Show HN: Motif – Scala-like pattern matching with Java 8

#34

Earlier quoted context omitted.

I hardly see how Scala is more painful on the eyes than good old Java.

Random example from a popular project: def bimap[C, X[_, _], D](g: Bijection[C, D])(implicit F: Bifunctor[X], evF: F[B] =:= Id[B], evG: G[A] =:= Id[A]): Bijection[X[A, C], X[B, D]] = bijection( F.bimap(_)(to(_), g.to(_)): Id[X[B, D]] , F.bimap(_)(from(_), g.from(_)): Id[X[A, C]] )

And I could cherry pick something just as hideous out of Java. Congrats.

Re: Show HN: Motif – Scala-like pattern matching with Java 8

#35

Earlier quoted context omitted.

Random example from a popular project: def bimap[C, X[_, _], D](g: Bijection[C, D])(implicit F: Bifunctor[X], evF: F[B] =:= Id[B], evG: G[A] =:= Id[A]): Bijection[X[A, C], X[B, D]] = bijection( F.bimap(_)(to(_), g.to(_)): Id[X[B, D]] , F.bimap(_)(from(_), g.from(_)): Id[X[A, C]] )

And I could cherry pick something just as hideous out of Java. Congrats.

Nobody disputed that but that's off topic. We're discussing the fact that Scala can be pretty ugly too.

Re: Show HN: Motif – Scala-like pattern matching with Java 8

#36

Earlier quoted context omitted.

I hardly see how Scala is more painful on the eyes than good old Java.

Random example from a popular project: def bimap[C, X[_, _], D](g: Bijection[C, D])(implicit F: Bifunctor[X], evF: F[B] =:= Id[B], evG: G[A] =:= Id[A]): Bijection[X[A, C], X[B, D]] = bijection( F.bimap(_)(to(_), g.to(_)): Id[X[B, D]] , F.bimap(_)(from(_), g.from(_)): Id[X[A, C]] )

Can you show me the equivalent java code? I would guess it's 200 lines of java or more. I would much rather spend the time to learn what that's doing than reading 200 lines of java.
Post reply on HN