This broke off accidentally into a private conversation...
----- Forwarded Message ---- > From: Steve Schveighoffer <[email protected]> > To: Andrei Alexandrescu <[email protected]> > Sent: Wed, August 25, 2010 5:54:09 PM > Subject: Re: [phobos] I think we need to make an emergency release > > > > > > ----- Original Message ---- > > From: Andrei Alexandrescu <[email protected]> > > > > On 8/25/10 14:39 PDT, Steve Schveighoffer wrote: > > > ----- Original Message ---- > > >> From: Andrei Alexandrescu<[email protected]> > > >> > > >> I needed Appender to be a reference type for std.format and std.stdio. > > >> The point is to be able to compose a complex stream read into a >sequence > > >> of simpler reads. This is possible if you use one Appender throughout, > > >> but I don't see why preclude people from appending output to their own > > >> strings. It's not a difficult to implement feature (my convoluted code > > >> notwithstanding), and it's useful. Why decide to not provide it? > > > > > > It is a reference type. There's only one pointer in the struct, that >points > > >to > > > the GC-allocated private Data struct. Or maybe I didn't understand you? > > > > I know it is a reference type (I was just explaining the change I >introduced). > > >The issue with your appender is that it makes it impossible for a user to > >append to an existing string and have the change reflected at all times in >the > > >string. > > Well, I didn't find any cases requiring that in std.format or std.stdio, but > they were mostly in unittests. Do you have a better example? Note that > performing things like builtin appends on an array allocated by Appender are >not > > a good idea, since appender completely ignores and does not update the > stored > length properly. > > Even an explanation of what you plan to do with the data at the same time > you > are appending would be good in lieu of an example. Maybe we can find a > better > > design, or provide an unsafe function to get a reference to the GC-allocated > array reference for those who want to live on the edge. I just dislike the > *requirement* of stepping into unsafe territory just to use Appender. It >seems > > to go against the spirit of most of Phobos. IMO the default should be the >safe > > way. > > -Steve > > > > > _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
