Syntactic sugar is just a way that we re-write our code to a simple and human-readable form, it does not change any function of a method.
IntelliJ IDEA offers a Desugar Scala Code function, you can use that to discover what this syntactic sugar actually stands for.
Here is an example:
def lift[T1,T2](f: T1 => T2):Try[T1]=>Try[T2] = _ map f
In IntelliJ IDEA, select(highlight) _ map f
, click Code->Desugar Scala Code in toolbar:
It will convert the code to something like this:
def lift[T1,T2](f: T1 => T2):Try[T1]=>Try[T2] = (triedT: _root_.scala.util.Try[T1]) => triedT.map(f)
Why this is equvalent? (=== represent equivalent)
(triedT: _root_.scala.util.Try[T1]) => triedT.map(f)
=== (triedT) => triedT.map(f) //Omit the input type, it can be inferred by the compiler
=== _.map(f) //There is only one input, it can be re-write as a _
=== _ map(f) //Omit .
=== _ map (f) //Add a space
=== _ map f //Omit parenthese