Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Misc Library
    • Labels:

      Description

      (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

        Activity

        Hide
        huynhjl added a comment -

        I think setOutGlobally is a good idea as it would minimize code breakage.

        Show
        huynhjl added a comment - I think setOutGlobally is a good idea as it would minimize code breakage.
        Hide
        Adriaan Moors added a comment -

        Unassigning and rescheduling to M6 as previous deadline was missed.

        Show
        Adriaan Moors added a comment - Unassigning and rescheduling to M6 as previous deadline was missed.

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Phillips
          • Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:

              Development