eliminate writeln et comp?

Sean Kelly sean at invisibleduck.org
Tue Mar 17 13:59:33 PDT 2009


== Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
> Ary Borenszweig wrote:
> > Andrei Alexandrescu wrote:
> >> Hey all y'all,
> >>
> >>
> >> Here's another nice bicycle shed discussion. During the recent
> >> discussion about globals being harmful, Walter told me something that
> >> made me think. I said, hey, there are things that are global - look at
> >> stdout. He said, well, that's a bad thing. He then argued that it
> >> would be better and cleaner to write:
> >>
> >> stdout.writeln("Hello, world");
> >>
> >> instead of the current:
> >>
> >> writeln("Hello, world");
> >>
> >> On one hand, I agree with Walter. On the other, I want to avoid the
> >> phenomenon of the all-too-long "Hello, world" example.
> >>
> >> What do you think?
> >
> > There must be something I'm missing here. Either writeln is using a
> > global "stdout" which you can't see in it's interface, or you are using
> > that global "stdout" yourself and invoking writeln on it. There's still
> > a global around. Nothing solved.
> The difference is that in the current call the use of the global is
> implicit.

Once D will accept both syntaxes for methods, it will be up to the user.

void fn( t1 p1, t2, p2 );
fn( v1, v2 ); <-> v1.fn( v2 );



More information about the Digitalmars-d mailing list