ACTION: Fix all your programs so they no longer rely
on the Felix textio C++ iostream bindings.

REASON: Removed all support for C++ iostreams.

HOWTO:

Use Cstdio instead of Iostream (in lib/std/textio).

istream, ostream no longer available,
use ifile, ofile instead.

cin, cout, cerr no longer available.
Use cstdin, cstdout, cstderr instead.


RATIONALE:

The primary reason is a bit of laziness. Currently the Input_text_file
abstraction requires 

        fopen_input: string -> input_text_file

This makes unqualified calls to fopen_input ambiguous if both
C and C++ stream instances are open:

        fopen_input "fred.file"

should have been ambiguous, but due to a bug in the flxg compiler
(now fixed) it randomly selected one. There was also a bug in the library
where the C++ fopen_input actually returned a C FILE*. 

This is because C++ iostreams are immobile objects. 
To use on you must first create an object, then call an open method
on it. Since Felix requires first class values for everything, you
would then have to return a garbage collectable pointer
and the object would have to go on the heap. This can be done
but it requires some "extreme hackery": see Re2 binding
for RE2 objects. [Note to self: provide a "language" way to automate
that crud!!!]

Manual deletion is not on (you could delete standard i/o buffers!)

To make matters worse: you cannot close a C++ istream or ostream.
Only fstreams can be closed. Unfortunately cin. cerr, cout are iostreams
whereas a disk file being opened would be an fstream. Casting
up to a stream would make them compatible but then not closable.

Altogether, there seems no reason to support iostreams: all formatting
should be done with strings anyhow, and C FILE* have none of
the problems of C++ iostreams. Whilst the stronger typing of C++ 
iostream stuff may be useful in C++ it is a hinderance in Felix.


Also warn: some versions of C/C++ libraries are broken.
Using clang 3.3svn on OSX 10.6.8 and --std=c++11 with both <stdio.h>
and <cstdio> #included,

        ::std::cstderr

breaks. Turns out to be a macro and the symbol it is defined to
is not in namespace std. This is all a bit unfortunate because
ISO C++ committee is deprecating C headers.


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to