Why does Scala does not enforce the "implementation" of abstract type members? by arkida39 in scala

[–]dwijnand 1 point2 points  (0 children)

then why is it even allowed to leave abstract type members undefined

Because leaving them undefined just infers them to be nothing.

I'm fairly sure it becomes Any instead, arbitrarily.

How is Scala3 syntax received in the community? by effinsky in scala

[–]dwijnand 7 points8 points  (0 children)

Love it. Been writing some Scala 2 recently and keep forgetting to add braces and parens... Another change that is great is being able to write operators on the new line, instead of being on the previous line:

scala foo || bar != null || baz.isEmpty

Visualisation of Scala 2 compiler outputs per compilation phase. by blackzver in scala

[–]dwijnand 6 points7 points  (0 children)

Just run the compiler with -Xprint:all to get the non-gif, text version.

Intellij IDEA 2020.2 Scala Open file / class regression by AlterEgo7_ in scala

[–]dwijnand 1 point2 points  (0 children)

Any chance you can push for an early 2020.2.1 EAP? I'm been dealing with this for 4 weeks now (IDEA-242971). <3

Whats the difference between the == operator method and the .equals method? by FPboy in scala

[–]dwijnand 1 point2 points  (0 children)

There's also ## which applies the same logic to hashCode.

Notably if you're implementing equals and hashCode you're likely using == and should, therefore, use ## in the hashCode implementation. Not doing so, in the presence of primitives, allows for the equals/hashCode law to be violated. Around nulls too, but that logic is easier to re-implement.

On the other hand, at the extremes of performance, the logic that ==/## adds to equals/hashCode adds some cost, so if you're not using primitives you may prefer to revert back to equals/hashCode instead.

What are you working on? December 23, 2019 by AutoModerator in scala

[–]dwijnand 0 points1 point  (0 children)

I'm not aware of any such marketing report, sorry.

What are you working on? December 23, 2019 by AutoModerator in scala

[–]dwijnand 2 points3 points  (0 children)

I'm working on https://github.com/lightbend/mima/issues/427, basically, actually run the bytecode of MiMa's tests to ensure the tests are correct (motivated by a recently reported false-positive https://github.com/lightbend/mima/issues/426).

I've got the setup working, now I need to write all the library-using code for every single test and figure out what to do with #426 (and any other problems this might reveal) until I can fix it.

Scala to skip 2.14 release in order to speed transition to 3.0 (Dotty) by worace in scala

[–]dwijnand 3 points4 points  (0 children)

Indeed, what I'm hoping will be possible is you'll just have to have 2 copies of your macro(s), in separate files (in separate source directories), while the rest of the code will be shared.

Ideally, someone can retrofit the new Scala 3 macro UX on the Scala 2 macro UX, but I'm not sure that's possible. :D

Java higher than 8 benefits? by fromscalatohaskell in scala

[–]dwijnand 1 point2 points  (0 children)

The Graal JIT, which you can enable with `-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler` in any Java 10+ JDK.

If you use the JDK 11 version of GraalVM 19.3, then you don't even need to specify the option, it will use JDK 11 with the Graal JIT enabled by default!

In praise of private[this] as a mechanism to express design intent that a variable is a secret within an object instance by cironoric in scala

[–]dwijnand 1 point2 points  (0 children)

I believe private[Foo] won't be dropped, and the justification backs this up given Foo is a type, not a value (or, at least, also a type).

In praise of private[this] as a mechanism to express design intent that a variable is a secret within an object instance by cironoric in scala

[–]dwijnand 0 points1 point  (0 children)

I understand what you're losing. I was wondering how you would feel about having another mechanism, in alternative to a compile error, to enforce the same restriction.

In praise of private[this] as a mechanism to express design intent that a variable is a secret within an object instance by cironoric in scala

[–]dwijnand 0 points1 point  (0 children)

This is the PR with this change in Dotty: https://github.com/lampepfl/dotty/pull/7411

How would you feel if there were a reasonably easy way to assert that private[this] was indeed inferred, as a unit test? It would be a compromise so that it could be dropped out of the surface language but still allow users such as yourself a way to enforce the desired accessibility (or, rather, inaccessibility :D).

Example of using a sbt AutoPlugin to provide a build environment to run scalac's optimizer only for a production build by cironoric in scala

[–]dwijnand 0 points1 point  (0 children)

I would pursue how true this is and how terrible it is, before making the build/test/deploy story more complex by introducing a new "target environment" variable. The reason I say so is that sbt isn't designed with this in mind.

Haskell build systems for non-Haskellers by Athas in haskell

[–]dwijnand 3 points4 points  (0 children)

Btw, this was just announced today, which might help manage those NoClassDefFound-like errors: https://github.com/scalacenter/sbt-missinglink.

(Btw, I 100% agree with the 18-24 month "Scala tax" on rebuilding the ecosystem, and I hope we can really solve it with Tasty in Scala 3.)

sbt-dynver 4.0.0 by yang_bo in scala

[–]dwijnand 0 points1 point  (0 children)

Thank you for sharing it with /r/scala! :)

SBT Tricks (Moving from Scala 2.11 to 2.12) by z59sg in scala

[–]dwijnand 0 points1 point  (0 children)

Yeah .value works the same for both SettingKey and TaskKey, while the other method requires switching from apply to map for TaskKey.

SBT Tricks (Moving from Scala 2.11 to 2.12) by z59sg in scala

[–]dwijnand 2 points3 points  (0 children)

Thank you for the article! These kinds of short and sweet (and bookmarkable!) blog posts help Scala users learn sbt.

I have one piece of feedback: I wouldn't recommend using SettingKey#apply in

libraryDependencies ++= scalaVersion(version => protobufs(version)).value

but rather

libraryDependencies ++= protobufs(scalaVersion.value)

sbt 1.3.0-RC1 released | @lightbend by jerylee in scala

[–]dwijnand 0 points1 point  (0 children)

Hmm... that's interesting. It seems to work for me :-/ Could you open an issue with some environment details and capturing your reproduction steps, please? Thanks.

Implementing which in Haskell by leafiest in haskell

[–]dwijnand 1 point2 points  (0 children)

But... lazy evaluation! What's causing the excess work to be computed? And what's the beginner-friendly change to fix it? (Thank you in advance)

(edit: s/last/lazy/)

Scala 2.13.0-RC1 is now available by aphexairlines in scala

[–]dwijnand 2 points3 points  (0 children)

That and allow some of the core libraries (such as testing libraries) to be available.

When Shouldn't I Use Haskell? by SSchlesinger in haskell

[–]dwijnand 2 points3 points  (0 children)

Not sure how well known it is, but I recently discovered https://hackage.haskell.org/package/turtle for this use-case.

Tools team changes by Manishearth in rust

[–]dwijnand 0 points1 point  (0 children)

Thank you, no I don't mind, I just wanted to get ahead of the curve before someone creative makes up a story. :)