Looking through the Scala 2.8 Predef class, I find that there is a method “locally”. As near as I can tell, it’s the same as Predef.identity, except for having the “@inline” annotation. What’s it for, and why is it important enough to be in Predef (and thus usable anywhere in Scala)?
Share
It is discussed here: http://www.scala-lang.org/node/3594
The idea was to avoid the programmer error of confusing a ‘dangling’ local block with the template of an object/class/trait.
If the programmer really wants that block to stand alone,
locallycould be used:This thread also suggested that the first code would produce a deprecation warning. This has not yet been added.