Fergus Henderson wrote:
> Sigbjorn Finne, you wrote:
> > 
> > I don't honestly see what having these handles as constant *gain* you,
> > so why then have them as such, if not having them constant gives you
> > extra expressiveness?
> 
> But, unless I'm missing something, making them non-constant doesn't
> give you any extra expressiveness.
> 
> Remember that the fact they are constant does not imply that the
> file they are connected to is constant.  Even if they are effectively
> thread-local, i.e if the file that stdin and stdout are connected to
> depends on which thread you're in, stdin and stdout themselves can
> still be constants, can't they?
Exactly!

I regard stdin, stdout, and stderr as names for abstract versions of
0, 1, and 2 (does my background in C programming on Unix show? :-).
These are just handles, the can be reconnected to anything.  If you
argue that you should be able to change the meaning of stdin I could
argue "This piece of code I've got uses the constant 5, this is not
what I want, I need to change the value of 5 locally when that code
runs.  Give me the machinery to do that!"

        -- Lennart




Reply via email to