Explicit syntax to discard the value of a side-effecting expression.
Explicit syntax to discard the value of a side-effecting expression.
Useful when -Ywarn-value-discard
compiler option is enabled.
Alternative syntax for applying some side effects on a value before returning it, without having to declare an intermediate variable.
Alternative syntax for applying some side effects on a value before returning it,
without having to declare an intermediate variable. Also, using setup
confines the "setting-up"
code in a separate code block which has more clarity and avoids polluting outer scope.
import javax.swing._ // this entire expression returns the panel new JPanel().setup { p => p.setEnabled(true) p.setSize(100, 100) }
Prints AST of the prefix in a compilation error.
Prints AST of the prefix in a compilation error. Useful for debugging macros.
Prints raw AST of the prefix in a compilation error.
Prints raw AST of the prefix in a compilation error. Useful for debugging macros.
Converts a boxed primitive type into an Opt
of its corresponding primitive type, converting null
into
Opt.Empty
.
Converts a boxed primitive type into an Opt
of its corresponding primitive type, converting null
into
Opt.Empty
. For example, calling .unboxedOpt
on a java.lang.Integer
will convert it to Opt[Int]
.
The "pipe" operator.
The "pipe" operator. Alternative syntax to apply a function on an argument. Useful for fluent expressions and avoiding intermediate variables.
someVeryLongExpression() |> (v => if(condition(v)) something(v) else somethingElse(v))