New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.9.0.RC5: Enumeration missing methods (comparing: 2.8.1.final) #4571
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4571?orig=1 |
DaveScala (davescala) said: But I don't understand the removal of the useful ones (mostly typical list methods) like: value
valueOf
equals
exists
filter
flatmap
forAll
foreach
getClass
hashCode
iterator
map
name
nextId
nextName
readResolve
valueOf Because of the missing of "valueOf" I found this difference. C:\Users\Dave>c:\scala-2.8.1.final\bin\scala
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_1
.
Type in expressions to have them evaluated.
Type :help for more information.
scala> object WeekDay extends Enumeration("Sun", "Mon", "Tue", "Wed", "Thu", "
i", "Sat") {
| type WeekDay = Value
| val Sun, Mon, Tue, Wed, Thu, Fri, Sat = Value
| }
defined module WeekDay
scala> WeekDay.
Fri Mon
Sat Sun
Thu Tue
Value ValueSet
ValueSet$$module Wed
apply asInstanceOf
equals exists
filter flatMap
forall foreach
getClass hashCode
isInstanceOf iterator
map maxId
name nextId
nextId_= nextName
nextName_= notify
notifyAll readResolve
scala$$Enumeration$$$$nameOf scala$$Enumeration$$$$nextNameOrElse
scala$$Enumeration$$$$nmap scala$$Enumeration$$$$populateNameMap
scala$$Enumeration$$$$topId scala$$Enumeration$$$$topId_=
scala$$Enumeration$$$$vmap scala$$Enumeration$$$$vsetDefined_=
toString valueOf
values wait
withName
C:\scala-2.9.0.RC5\examples>scala
Welcome to Scala version 2.9.0.RC5 (Java HotSpot(TM) Client VM, Java 1.6.0_18).
Type in expressions to have them evaluated.
Type :help for more information.
scala> object WeekDay extends Enumeration("Sun", "Mon", "Tue", "Wed", "Thu", "Fr
i", "Sat") {
| type WeekDay = Value
| val Sun, Mon, Tue, Wed, Thu, Fri, Sat = Value
| }
defined module WeekDay
scala> WeekDay.
Fri Mon Sat Sun Thu
Tue ValueSet Wed WeekDay apply
asInstanceOf isInstanceOf maxId toString values
withName
scala> WeekDay. |
@hubertp said: |
DaveScala (davescala) said: Hopefully this will be well documented in a sort of "Quick 2.8.1 -> 2.9.0 migration" document or else in the api documentation. I close this ticket then. |
DaveScala (davescala) said: When I compile this file which uses a deprecated valueOf method I get an error but some other deprecated apis get a message with "run scalac with -deprecation" or alike C:\scala-2.9.0.RC5\examples>scalac scalaenums.scala
scalaenums.scala:8: error: value valueOf is not a member of object scalaenums.We
ekDay
println(WeekDay.valueOf("Wed")) // returns Some(Wed)
^
one error found I reopen this ticket because I am not sure if the ticket can be seen by you if I post on a closed ticket. |
@paulp said: |
DaveScala (davescala) said: C:\scala-2.8.1.final\examples>C:\scala-2.8.1.final\bin\scalac.bat scalaenums.sca
la
warning: there were deprecation warnings; re-run with -deprecation for details
one warning found
C:\scala-2.8.1.final\examples>C:\scala-2.8.1.final\bin\scalac.bat -deprecation s
calaenums.scala
scalaenums.scala:8: warning: method valueOf in class Enumeration is deprecated:
use withName instead
println(WeekDay.valueOf("Wed")) // returns Some(Wed)
^
one warning found |
@paulp said:
Also deprecated in 2.8.0. The last version it appeared undeprecated was 2.7.7. If the people missing those warnings thought they could jump from 2.7.7 to 2.9.0 and recompile, they were going to have to find out otherwise anyway. |
Comparing with version 2.8.1.final too many methods have been removed from Enumeration:
I can understand the removal of the concurrency methods( wait, notify etc) and the odd names with $$ and _ signs
which I don't know what they are for (they look like internal methods which shouldn't have been exposed).
But I don't understand the removal of the useful ones (mostly typical list methods) like:
value
valueOf
equals
exists
filter
flatmap
forAll
foreach
getClass
hashCode
iterator
map
name
nextId
nextName
readResolve
valueOf
Because of the missing of "valueOf" I found this difference.
Btw: I mentioned nextId, nextName and readResolve for completeness but I don't know what they are for.
C:\Users\Dave>c:\scala-2.8.1.final\bin\scala
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_1
.
Type in expressions to have them evaluated.
Type :help for more information.
scala> object WeekDay extends Enumeration("Sun", "Mon", "Tue", "Wed", "Thu", "
i", "Sat") {
| type WeekDay = Value
| val Sun, Mon, Tue, Wed, Thu, Fri, Sat = Value
| }
defined module WeekDay
scala> WeekDay.
Fri Mon
Sat Sun
Thu Tue
Value ValueSet
ValueSet$$module Wed
apply asInstanceOf
equals exists
filter flatMap
forall foreach
getClass hashCode
isInstanceOf iterator
map maxId
name nextId
nextId_= nextName
nextName_= notify
notifyAll readResolve
scala$$Enumeration$$$$nameOf scala$$Enumeration$$$$nextNameOrElse
scala$$Enumeration$$$$nmap scala$$Enumeration$$$$populateNameMap
scala$$Enumeration$$$$topId scala$$Enumeration$$$$topId_=
scala$$Enumeration$$$$vmap scala$$Enumeration$$$$vsetDefined_=
toString valueOf
values wait
withName
C:\scala-2.9.0.RC5\examples>scala
Welcome to Scala version 2.9.0.RC5 (Java HotSpot(TM) Client VM, Java 1.6.0_18).
Type in expressions to have them evaluated.
Type :help for more information.
scala> object WeekDay extends Enumeration("Sun", "Mon", "Tue", "Wed", "Thu", "Fr
i", "Sat") {
| type WeekDay = Value
| val Sun, Mon, Tue, Wed, Thu, Fri, Sat = Value
| }
defined module WeekDay
scala> WeekDay.
Fri Mon Sat Sun Thu
Tue ValueSet Wed WeekDay apply
asInstanceOf isInstanceOf maxId toString values
withName
scala> WeekDay.
The text was updated successfully, but these errors were encountered: