Hacker News new | past | comments | ask | show | jobs | submit login

e.g. :+= and :++= (which are both commonly used in build.sbt files). If you don't know the difference between those it's rather hard to search for.



Nono! Typesafe, I mean Lightbend, declared that random strings of symbols are just method names, so no need to worry about that operator overloading thing! Except methods with ":" in the name tend to work differently wrt. precedence.

(Look, I'm not on a crusade against Typesafe/Lightbend, but they've been hugely disingenous on a lot of things like this. I could have accepted it if they'd just said "yes, it's operator overloading, but better". Instead they chose this ridiculous disingenuous "nono, it's just method names!" approach. In my book, the only people who can get away get arbitrary method/function naming are the LISP/Scheme people. Because in LISP/Scheme there is no precedence to worry about.)


I have never seen them. Do they actually exist?

Most of the time, there is := (set something), += (add something) and ++= (add multiple things). I think that's pretty straight-forward.


Yes, they're very common in build.sbt files. How else would you add library dependencies?

I know exactly what they do; the underlying reasoning is very consistent, maybe even elegant. But if you don't know and need to understand/modify a build.sbt file, it's very tricky to find out.


> How else would you add library dependencies?

Like this?

  libraryDependencies ++= Seq(...)


Ok, so what's the difference between that and

    libraryDependencies :++= Seq(...)
? Because I've definitely seen that in some build.sbt files.


This doesn't exist:

    error: value :++= is not a member of sbt.TaskKey[Seq[sbt.ModuleID]]




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: