On Wed, 2006-08-16 at 00:51 +1000, skaller wrote:

Interesting quirk with refs. At the moment this works:
----------------------------
#include <flx.flxh>

var x = 1;
ref px <- x;
print px; endl;
x = 2;
print px; endl;
----------------------------

Well, the parameter case isn't harder, but I have
discovered an interesting limitation.

Felix cannot take the address of an arbitrary lvalue:
it can ONLY take the address of a variable.

It can ASSIGN to any lvalue .. it can't address one.

It isn't even allowed to do this:

struct X { a: int; };
var x = X(1);
var pa = &x.a;

Of course .. you can certainly get the "C" address of
any lvalue.. but that's not a Felix pointer, its 
a C pointer .. and the function for doing that is
in the library .. the compiler knows nothing about it.

The reason is: the assignment combinator is just a binary
operator:

        `BEXPR_assign (a,b)

The only constraint is the type of a must be an lvalue.
However 

        `BEXPR_ref (i,ts)

is used for addressing. This is the same shape as the name
of a variable:

        `BEXPR_name (i,ts)

except it stands of a pointer to the variable.
[The 'ts' here is a list of types, for polymorphism stuff]

I need to fix this. Any address MUST be derived from
an actual variable .. so the frame pointer of the containing
routine can be found.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to