You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed in #6710 and on scala-lang [1], the "box" and "unbox" methods of AnyVal classes (except Unit) are not actually implemented by the code in AnyVal [2].
Instead, the real implementation comes from BoxesRunTime (e.g. [3]). This is functionally different, creating potential for confusion.
As per the scala-lang discussion and #6710, changing the AnyVal code itself would have too much potential impact and thus be too risky. Documenting the behaviour would be a safer option.
From Paul Phillips' comment:
"If we're not using it in generated code and don't intend to, the ideal change is probably to deprecate it and then remove it. Next best (and to do regardless) is to document the behavior and the fact that it isn't actually used by the compiler." [4]
Source code of AnyVal classes and screenshots of documentation after
ant all.clean
ant build
./tools/codegen-anyvals
ANT_OPTS="-Xms512M -Xmx1024M -Xss1M -XX:MaxPermSize=128M" ant docs
As discussed in #6710 and on scala-lang [1], the "box" and "unbox" methods of AnyVal classes (except Unit) are not actually implemented by the code in AnyVal [2].
Instead, the real implementation comes from BoxesRunTime (e.g. [3]). This is functionally different, creating potential for confusion.
As per the scala-lang discussion and #6710, changing the AnyVal code itself would have too much potential impact and thus be too risky. Documenting the behaviour would be a safer option.
From Paul Phillips' comment:
"If we're not using it in generated code and don't intend to, the ideal change is probably to deprecate it and then remove it. Next best (and to do regardless) is to document the behavior and the fact that it isn't actually used by the compiler." [4]
Source code of AnyVal classes and screenshots of documentation after
attached.
[1] https://groups.google.com/d/topic/scala-language/kBQnJ3XuKeM/discussion
[2] https://github.com/scala/scala/blob/master/src/compiler/scala/tools/cmd/gen/AnyVals.scala#L2321
[3] https://github.com/scala/scala/blob/master/src/library/scala/runtime/BoxesRunTime.java#L87
[4] https://groups.google.com/d/msg/scala-language/kBQnJ3XuKeM/qvLnORIiXqAJ
The text was updated successfully, but these errors were encountered: