"libflx the flx API interface
============================
libflx is progrmattic interface to the functionality offered by the 'flx' 
executable. It is implemented as a
Felix object and offered as a plugin. It was motivated by a sick to deathness 
of stringing together argument
strings to call the 'flx' compiler."


This really needed to be done.
Same for "flx_pkgconfig".

I'm currently rewriting "flx" to make it more modular, and so it can support
things like:

        flx --expect --indir=test --regex='.*\.flx'

which will compile and run every *.flx file in directory test,
save the output, and compare it with the matching *.expect file.
So  you can run the whole test suite in a single command.

BTW: simplifications:

    include "PKGTOOL/libflx_factory";
    include "PKGTOOL/pkgtool";
    open PkgTool;
    var myflx = libflx_factory();

You can write that as:

    var myflx = #libflx_factory;

It would be nice to think about caching the result of such a call,
in the event it is pure, so you can call the function many times
with evaluation only once. But I diverge ...

    myflx.set_dbug(false);
    myflx.set_showcode(true);
    myflx.set_snort(true);
    match myflx.init_compiler() with
    |OK[string] => {

Patterns to match constructors do not require explicit type variable 
instantiation.
The type is fixed by the match argument. So you can just write:

    | OK =>

Also note that Felix has statement matches, that is instead of
a match returning a procedure closure which is then executed,
you can just put the statements. This will usually be a lot
more efficient. So instead of

  match x with | A => { doit(); } | B => { doother(); } endmatch;

you can write:

  match x with | A => doit(); | B => doother(); endmatch;


This is like the usual C assert trick:

          assert_true(m == "A\na\n", 
            "Compiling D01-libflx.flx to shared object and running");

however it probably won't work as expected. The reason is that the
builtin assert knows the Felix and C++ location in the file.
Any functional wrapper around it will report the location of the
assert, not the function (even if it is inlined).

So I need to add this one to my todo list.
assert actually throws this:

#define FLX_ASSERT_FAILURE(f,sl,sc,el,ec) \
  throw ::flx::rtl::flx_assert_failure_t 
(::flx::rtl::flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__)

Not too hard to add a message.

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




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to