Re: JavaMemoryModel: Why not delegate System.in/out/err, instead of see it as special case?

From: Doron Rajwan (doron@rajwan.org)
Date: Sun Oct 05 2003 - 00:35:11 EDT


Thanks. I see the point.

Probably out of this group scope, but I would still
recommend to mark these methods as deprecated, and
give an alternative, so it can be replace in few
years. The new mechanism can even support per-thread
setting (some of the examples given before actually
requires it).

Doron.

--- Sylvia Else <sylviae@optushome.com.au> wrote:
> At 09:36 PM 3/10/2003 +0200, Doron Rajwan wrote:
>
> >I do not understand why System.in, out, and err
> won't be replaced with
> >delegation.
>
>
> A not improbable scenario is that a program saves
> the initial content of
> System.err, and then calls System.setErr() to
> redirect error messages to
> somewhere more appropriate. The original contents
> would be used for severe
> error conditions, such as not being able to write to
> the redirected stream.
>
> This mechanism would break under your proposal.
>
> Another scenario that breaks is an attempt at
> temporary redirection, by
> storing the content of System.out, and restoring it
> later.
>
> One may wonder at the thinking of the person who
> perpetrated the
> System.setOut, Err, In() mechanism, but we do seem
> to be stuck with it.
>
> Sylvia.
>
>
>
> >
> >
> >What I mean is:
> >
> >1. Define a class that extends PrintStream and
> delegate to another
> >PrintStream.
> >
> >2. System.out will be final instance of this class,
> w/o any magic involved.
> >
> >3. When someone wants to change the output, they
> can use a method to
> >change the delegation. This method can be public
> method, and the Security
> >check will be inside it.
> >
> >4. The native magic can be removed.
> >
> >
> >
> >I cannot see how this change will break anything,
> except, maybe, when
> >someone sync(System.out) in order to print few
> lines together. Maybe this
> >can be solved too, using some tricks.
> >
> >
> >
> >My question is: have you considered other options,
> except declaring these
> >3 variables as special case?
>
>
>

=====
Doron Rajwan, mailto:doron@rajwan.org

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:51 EDT