[antlr-interest] FEATURE REQUEST: std::stream -- remove

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Feb 16 07:42:16 PST 2004


on 2/16/04 12:03 PM, Arnar Birgisson at arnarb at oddi.is wrote:

> Sun, 15. Feb 2004 kl. 09:23:08 +0200 skrifa­i Ruslan Zasukhin:
>> So I dream, that ANTLR C++ runtime sources of Lexer / Parser
>> depend NOT on std::streams, but on some C++ interface class of stream
>> 
>>     I_Istream
>>     I_OStream
> 
> I beg to differ. I see the std::stream definition as an interface declaration,
> since there are many implementations of it. Therefore, I see no reason why
> ANTLR should implement another interface layer to encapsulate the std::stream
> interface.
> 
> The std::stream library was designed (IMHO successfully) to be easy to extend
> and tack on top of various input/output systems. Having such a standard
> greatly simplifies development in my case, instead of each library or project
> you use having it's own interface declarations. That only means that in your
> own project, you need wrappers to make all those stream interfaces work
> together, which is kind of ironic if most of them use the same stream
> implementation behind those interfaces.
> 
> I say ANTLR should stick to std::stream, whereas that is already such an
> interface as you describe, and a standard one too. Chances are that users
> already have std::stream wrappers for their custom streams (at least that has
> been my case).

..............

> Writing std::stream implementations is easy, usually only a matter of
> extending std::streambuf. -- In your case, writing a std::stream wrapper over
> your interfaces is also an option, and could benefit you in more librarires
> than just ANTLR.
> 
>> I believe using of interfaces is flexible and good OO design feature.
> 
> This is a very good point, and I totally agree. However, in my opinion,
> std::stream is just an interface declaration (and a good one), not an
> implementation. For that we have SGI, Microsoft, etc.

I still not agree.

In the modern C++ exists 2 major conception:

    interfaces
    templates.    

Developer of good LIBRARY and FRAMEWORK must choose between them,
Or even mix them.

std::Streams are childs of STL and therefore are TEMPLATES.
std::stream IS NOT interface by its mean.

We in our project totally avoid using of STL classes.
Few reasons

1) we use many platforms and many compilers.
   Each compiler vendor provide own implementation of STL standard.
   You have NO guarantee that on some compiler some class do not have bug.
   Just look into release info of each C++ compiler!
   How many bugs are fixed in each new release.


2) second reason -- even modern C++ compilers still are not perfect on
TEMPLATES compilation. If you make
    #include <stream>

into almost empty .cpp file, the code size of this .obj file grow in about
100 KB in the LIBRARY.

If you have in project 1000 files then you get size blowing for NOTHING!
100MB thanks to STD classes. This is not acceptable for us.

On start we have wrap STD::stream by own own IStream interfaces,
As result only ONE .cpp file have grow to 100KB.   You see point?
And Now we ABSOLUTLY have THROW OUT usage of STL classes.


NOT STD::stream must be wrapper!!!
It self must be wrapped.


------
Back to ANTLR.

I am sure that ANTLR use just 2-4 simple calls to stream,
Read char, write char.

So it will be VERY EASY add SMAL interface,
And ONE SMALL implementation of this interface around std::stream.


Most probably nobody is going do this.
And today STL idea eat a lots of brains. Just look on BOOST.
Also great of course.

But NOT EVERYTHING must be made on TEMPLATES.
Interfaces are FAR FAR more powerful technique,
Especially for such projects as ANTLR.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list