i have noticed exclusively use lazy val assignments avoid unnecessary computations, , can't see many situations 1 not want (dependency on mutable variables being notable exceptions of course).
it seem me 1 of great advantages of functional programming , 1 should encourage use whenever possible and, if understood correctly, haskell default.
so why scala values not lazy default? solely avoid issues relating mutable variables?
the big difference here between scala , haskell scala allows side-effects whereas haskell not.
laziness results in sorts of problems in language allows side-effects @ arbitrary points in program, order in side-effects take place becomes non-deterministic.
nearly transparent java interoperability plays large role in design of scala, , java libraries typically full of side-effects.
Comments
Post a Comment