Scala - Explicitly stating the short circuiting in defining && and || functions -


in scala source code boolean (here), said functions && , || can not defined using => syntax.

// compiler won't build these seemingly more accurate signatures // def ||(x: => boolean): boolean // def &&(x: => boolean): boolean 

but can't see problem definitions!

the source code said won't rather can't, maybe have wrongly interpreted it.

if see line 56 of boolean.scala, find explaination ||.

this method uses 'short-circuit' evaluation , behaves if declared def ||(x: => boolean): boolean. if a evaluates true, true returned without evaluating b.

same && in source code. sum up, can define there no need because of short-circuiting.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -