There is a nasty issue in Felix which remains to be sorted out.
Beware!

Suppose we have a file we want to refactor:

        var x = 1;
        fun sum (y:int) = x + y;

and we make a library file:

        class S {
                fun sum (y:int) = x + y;
        }

and a program file

        include "libraryfile";
        open S;
        var x = 1;
        println$ sum 2;

then everything works UNLESS its in the standard library.
Then it fails because the standard library is bound once
and the binding cached. And there is no "x" in the library file.

This is known as hijacking. The problem is that library code
can refer to global variables in your program.

This can be "fixed" by making sure your program is in a class,
then the global is in the class too. Just don't open the class!

        include "libraryfile";
        open S;
        class Program {
                var x = 1;
                println$ sum 2;
        }

Now, the variable x is not visible to the library file.

The fact that the standard library is special because it is prebound
is a BUG. The problem above arises from the set-wise lookup
and the fact program code is in the global scope. So the library
code can "look forward" into the program to find globals.

[The actual example I spotted is "xqt" which is basically a popen
with a bit of instrumentation and error handling. Its in flx, but
the new library modules I'm putting in the library call it.]

I don't have a good solution in mind.

--
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