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
[paulp says: I think this would be hard to change. What about a new method like setOutGlobally?]
I've noticed that Console.setOut behaves differently than
System.setOut.
Console.setOut only affects the current thread while System.setOut
affects the whole JVM. The scaladoc does not indicate that setOut is
restricted to the current thread and I presume most callers would be
surprised by that behavior. Additionally the REPL spawns a thread when
interpreting each line, so Console.setOut does not persist.
I did a bit of investigation and I'm guessing that the change was made
so that Console.withOut would behave properly in a multi-threaded
context. See https://lampsvn.epfl.ch/trac/scala/changeset/6858.
Could setOut be reimplemented so that it affects the whole JVM while
retaining the withOut semantic to override it during a thunk
execution? (along the line of making outVar a var and having setOut
reassigning it to a new DynamicVariable). Or do you think the current
approach is better?
--Jean-Laurent
The text was updated successfully, but these errors were encountered:
I labeled this as "good first issue" even it isn't clear what's next here. Didn't we deprecate setOut in favor of withOut? Someone could assess the situation and make a suggestion about whether the ticket should remain open, and if so, what addressing it should look like.
(Email from huynhjl@gmail.com to scala-user.)
[paulp says: I think this would be hard to change. What about a new method like setOutGlobally?]
I've noticed that Console.setOut behaves differently than
System.setOut.
Console.setOut only affects the current thread while System.setOut
affects the whole JVM. The scaladoc does not indicate that setOut is
restricted to the current thread and I presume most callers would be
surprised by that behavior. Additionally the REPL spawns a thread when
interpreting each line, so Console.setOut does not persist.
I did a bit of investigation and I'm guessing that the change was made
so that Console.withOut would behave properly in a multi-threaded
context. See https://lampsvn.epfl.ch/trac/scala/changeset/6858.
Could setOut be reimplemented so that it affects the whole JVM while
retaining the withOut semantic to override it during a thunk
execution? (along the line of making outVar a var and having setOut
reassigning it to a new DynamicVariable). Or do you think the current
approach is better?
--Jean-Laurent
The text was updated successfully, but these errors were encountered: