January 31, 2004
"C" <dont@respond.com> wrote in message news:bvbpjm$2sjj$1@digitaldaemon.com...
> Ill try to use Mattys libs to find the bottleneck , as reading line by
line
> is a common operation.

I tend to use std.file.read() followed by std.string.splitlines().


January 31, 2004
No, but I'll certainly volunteer reviewing services

"Walter" <walter@digitalmars.com> wrote in message news:bvfhj7$31e4$1@digitaldaemon.com...
>
> "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:bvc0vu$82o$2@digitaldaemon.com...
> > Walter, did anyone do a review on this before accepting it into Phobos?
> This
> > needs a serious rewrite, if not a redesign.
>
> No. It was very early on, done just to get things off the ground. It could use a rewrite. Anyone up for it?
>
>


January 31, 2004
Walter wrote:
> "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message
> news:bvc0vu$82o$2@digitaldaemon.com...
> 
>>Walter, did anyone do a review on this before accepting it into Phobos?
> 
> This
> 
>>needs a serious rewrite, if not a redesign.
> 
> No. It was very early on, done just to get things off the ground. It could
> use a rewrite. Anyone up for it?
> 

Here's an attempt:

http://ikagames.com/andy/d/stream.d

It's basically a bunch of classes that each do some small thing, and accepts a parent class as a template argument.  The stream aliases at the very bottom mash them into a cohesive class.

If nothing else, it'll get some ideas on the table. :)

 -- andy
January 31, 2004
Andy Friesen wrote:

> Here's an attempt:
> http://ikagames.com/andy/d/stream.d
[...]

Tested it like this:

import stream;

void main(){
  ReadableFile src=new ReadableFile("");
  while(!src.eof()){
    printf(".");
    Console.writeLine= src.readLine;
  }
  Console.writeLine="Hello world\n";
}


But it did not throw an error.

So long.

January 31, 2004
Manfred Nowak wrote:

> Andy Friesen wrote:
> 
>>Here's an attempt:
>>http://ikagames.com/andy/d/stream.d
> 
> [...]
> 
> Tested it like this:
> 
> import stream;
> 
> void main(){
>   ReadableFile src=new ReadableFile("");
>   while(!src.eof()){
>     printf(".");
>     Console.writeLine= src.readLine;
>   }
>   Console.writeLine="Hello world\n";
> }
> 
> 
> But it did not throw an error.
> 

hm.  Works for me.

If it's not throwing an error, then fopen("") is returning a non-null value when "" is passed as a filename.  This is puzzling.

 -- andy
January 31, 2004
Quick note ( 859 )
        return handle != null;

should read !== null ( i know u know this ).

I like this template stacking , 'bolt-ins' you call them ?  Looks like fun , Ill play around with them :D.  Is Modern C++ the only book that does things like this ?  Another source of documentation , examples , tutorial would be cool too.

Also some unittests and examples ?  I tested the streams on the 250K file with


void main ()
{
 try
 {
  ReadableFile x = new ReadableFile("tralala");

  while ( x.eof() )
  {
   Console.writeLine(x.readLine() );

  }
 }

 catch (IOError x)
 {
  Console.writeLine( x.toString() ) ;
 }
}

and I get no printing to stdout , it ends within .5 second , am I using it wrong ?

Thanks,
C
"Andy Friesen" <andy@ikagames.com> wrote in message
news:bvfk4b$3tl$1@digitaldaemon.com...
> Walter wrote:
> > "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:bvc0vu$82o$2@digitaldaemon.com...
> >
> >>Walter, did anyone do a review on this before accepting it into Phobos?
> >
> > This
> >
> >>needs a serious rewrite, if not a redesign.
> >
> > No. It was very early on, done just to get things off the ground. It
could
> > use a rewrite. Anyone up for it?
> >
>
> Here's an attempt:
>
> http://ikagames.com/andy/d/stream.d
>
> It's basically a bunch of classes that each do some small thing, and accepts a parent class as a template argument.  The stream aliases at the very bottom mash them into a cohesive class.
>
> If nothing else, it'll get some ideas on the table. :)
>
>   -- andy


January 31, 2004
In article <bvh0i9$2cqa$1@digitaldaemon.com>, C says...
>
>Quick note ( 859 )
>        return handle != null;
>
>should read !== null ( i know u know this ).
>
>I like this template stacking , 'bolt-ins' you call them ?  Looks like fun , Ill play around with them :D.  Is Modern C++ the only book that does things like this ?  Another source of documentation , examples , tutorial would be cool too.
>
>Also some unittests and examples ?  I tested the streams on the 250K file with
>
>
>void main ()
>{
> try
> {
>  ReadableFile x = new ReadableFile("tralala");
>
>  while ( x.eof() )
---------------------- while ( !x.eof() ) -------------------------- ?
>  {
>   Console.writeLine(x.readLine() );
>
>  }
> }
>
> catch (IOError x)
> {
>  Console.writeLine( x.toString() ) ;
> }
>}
>
>and I get no printing to stdout , it ends within .5 second , am I using it wrong ?
>
>Thanks,
>C
>"Andy Friesen" <andy@ikagames.com> wrote in message
>news:bvfk4b$3tl$1@digitaldaemon.com...
>> Walter wrote:
>> > "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:bvc0vu$82o$2@digitaldaemon.com...
>> >
>> >>Walter, did anyone do a review on this before accepting it into Phobos?
>> >
>> > This
>> >
>> >>needs a serious rewrite, if not a redesign.
>> >
>> > No. It was very early on, done just to get things off the ground. It
>could
>> > use a rewrite. Anyone up for it?
>> >
>>
>> Here's an attempt:
>>
>> http://ikagames.com/andy/d/stream.d
>>
>> It's basically a bunch of classes that each do some small thing, and accepts a parent class as a template argument.  The stream aliases at the very bottom mash them into a cohesive class.
>>
>> If nothing else, it'll get some ideas on the table. :)
>>
>>   -- andy
>
>


January 31, 2004
Doh!  Im a jackass :S.

Took 3 seconds ( aproximate ), considerably faster !

C

"larry cowan" <larry_member@pathlink.com> wrote in message news:bvh1cj$2e8i$1@digitaldaemon.com...
> In article <bvh0i9$2cqa$1@digitaldaemon.com>, C says...
> >
> >Quick note ( 859 )
> >        return handle != null;
> >
> >should read !== null ( i know u know this ).
> >
> >I like this template stacking , 'bolt-ins' you call them ?  Looks like
fun ,
> >Ill play around with them :D.  Is Modern C++ the only book that does
things
> >like this ?  Another source of documentation , examples , tutorial would
be
> >cool too.
> >
> >Also some unittests and examples ?  I tested the streams on the 250K file with
> >
> >
> >void main ()
> >{
> > try
> > {
> >  ReadableFile x = new ReadableFile("tralala");
> >
> >  while ( x.eof() )
> ---------------------- while ( !x.eof() ) -------------------------- ?
> >  {
> >   Console.writeLine(x.readLine() );
> >
> >  }
> > }
> >
> > catch (IOError x)
> > {
> >  Console.writeLine( x.toString() ) ;
> > }
> >}
> >
> >and I get no printing to stdout , it ends within .5 second , am I using
it
> >wrong ?
> >
> >Thanks,
> >C
> >"Andy Friesen" <andy@ikagames.com> wrote in message
> >news:bvfk4b$3tl$1@digitaldaemon.com...
> >> Walter wrote:
> >> > "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:bvc0vu$82o$2@digitaldaemon.com...
> >> >
> >> >>Walter, did anyone do a review on this before accepting it into
Phobos?
> >> >
> >> > This
> >> >
> >> >>needs a serious rewrite, if not a redesign.
> >> >
> >> > No. It was very early on, done just to get things off the ground. It
> >could
> >> > use a rewrite. Anyone up for it?
> >> >
> >>
> >> Here's an attempt:
> >>
> >> http://ikagames.com/andy/d/stream.d
> >>
> >> It's basically a bunch of classes that each do some small thing, and accepts a parent class as a template argument.  The stream aliases at the very bottom mash them into a cohesive class.
> >>
> >> If nothing else, it'll get some ideas on the table. :)
> >>
> >>   -- andy
> >
> >
>
>


January 31, 2004
C wrote:
> Quick note ( 859 )
>         return handle != null;
> 
> should read !== null ( i know u know this ).

Since handle is a pointer, and not a reference, it doesn't matter.  I suppose it's a good idea, though, as it's better self-documentation if it consistently behaves like a reference.

> 
> I like this template stacking , 'bolt-ins' you call them ?  Looks like fun ,
> Ill play around with them :D.  Is Modern C++ the only book that does things
> like this ?  Another source of documentation , examples , tutorial would be
> cool too.

Modern C++ goes way, way further than this.  Most compilers tremble at the mere mention of Loki. (a library made by the same author, for demonstrating the techniques implemented in the book)

> 
> Also some unittests and examples ?
> 

Good idea.

 -- andy
January 31, 2004
"C" <dont@respond.com> wrote in message news:bvh0i9$2cqa$1@digitaldaemon.com...
> Quick note ( 859 )
>         return handle != null;
>
> should read !== null ( i know u know this ).
>
> I like this template stacking , 'bolt-ins' you call them ?  Looks like fun
,
> Ill play around with them :D.  Is Modern C++ the only book that does
things
> like this ?  Another source of documentation , examples , tutorial would
be
> cool too.

ATL uses this a lot, although they don't name the technique, so ATL Internals is also a good text.

>
> Also some unittests and examples ?  I tested the streams on the 250K file with
>
>
> void main ()
> {
>  try
>  {
>   ReadableFile x = new ReadableFile("tralala");
>
>   while ( x.eof() )
>   {
>    Console.writeLine(x.readLine() );
>
>   }
>  }
>
>  catch (IOError x)
>  {
>   Console.writeLine( x.toString() ) ;
>  }
> }
>
> and I get no printing to stdout , it ends within .5 second , am I using it wrong ?
>
> Thanks,
> C
> "Andy Friesen" <andy@ikagames.com> wrote in message
> news:bvfk4b$3tl$1@digitaldaemon.com...
> > Walter wrote:
> > > "Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:bvc0vu$82o$2@digitaldaemon.com...
> > >
> > >>Walter, did anyone do a review on this before accepting it into
Phobos?
> > >
> > > This
> > >
> > >>needs a serious rewrite, if not a redesign.
> > >
> > > No. It was very early on, done just to get things off the ground. It
> could
> > > use a rewrite. Anyone up for it?
> > >
> >
> > Here's an attempt:
> >
> > http://ikagames.com/andy/d/stream.d
> >
> > It's basically a bunch of classes that each do some small thing, and accepts a parent class as a template argument.  The stream aliases at the very bottom mash them into a cohesive class.
> >
> > If nothing else, it'll get some ideas on the table. :)
> >
> >   -- andy
>
>