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
Deprecate mutable.Stack #9068
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9068?orig=1 |
@Ichoran said: |
Chris Martin (chris-martin) said (edited on Jan 4, 2015 10:12:56 AM UTC): If the deprecation instructions would be to rewrite val stack: collection.mutable.Stack[A] = ???
val x = stack.pop()
stack.push(y) as var stack: List[A] = ???
val x = stack.head
stack = stack.tail
stack +:= y then I think the result is clearly worse. |
@Ichoran said: var stack: List[A] = ???
stack = prefix ::: stack You'd think that var stack: mutable.Stack[A] = ???
stack = prefix ++: stack might work, but you'd be wrong because So you are left with a convenience class that looks like it nicely encapsulates mutability, but in fact is full of unexpected performance gotchas because it turns out that to override everything relevant is actually really tedious and difficult to keep straight, especially as the library evolves. It's better to just be honest about the situation and deprecate it than to try to fix all the problems now and then maintain the fixes every time the library changes. |
Chris Martin (chris-martin) said: I'd find it rather disheartening if Scala lost its stack as a result of getting lost down rabbit holes like |
@sschaef said: |
@szeiger said: |
@szeiger said: |
There is just no reason to keep this class, it is only a wrapper around a mutable reference to
List
.immutable.Stack
has already been deprecated (in scala/scala@3cc99d7), to me it looks like it is just an oversight that the mutable variant isn't deprecated as well.The text was updated successfully, but these errors were encountered: