Scala method call parameters with colon -
final def apply(block: => result): action[anycontent] = apply(bodyparsers.utils.ignore(anycontentasempty: anycontent))(_ => block) does know anycontentasempty: anycontent mean ? particularly : anycontent ?
does know
anycontentasempty: anycontentmean ?
it typed expression.
particularly
: anycontent?
this type ascription, used ascribe type expression, making expression typed expression.
normally, scala computes types of expressions without help, can ascribe specific type expression, if don't 1 scala computes.
for example, expression
42 scala computes type int. write
42: int instead, , same result. if don't want 42 typed int, can ascribe different type it, e.g.:
42: long now, expression has type long instead of int. if assign val, example, , don't provide type val, scala infer type long:
val = 1 // 1 has type int, therefore scala infers type int val b: long = 1 // b typed long, therefore scala converts 1 long val c = 1: long // 1 typed long, therefore scala infers type long c you can use guide scala infer more sensible type, or pick particular overload.
Comments
Post a Comment