Tuesday, 15 April 2014

scala - What does 'this: =>' construct mean? -



scala - What does 'this: =>' construct mean? -

i've seen couple of time code in scala libraries. mean?

trait securedsettings { this: globalsettings => def somemethod = {} ... }

trait { def foo } class b { self: => def bar = foo //compiles } val b = new b //fails val b = new b //compiles

it means b instances must inherit (mix-in) a. b not a, instances promised so, hence can code b if a.

scala

No comments:

Post a Comment