I am thinking of introducing a new type to Felix: @t. This is a pointer to a t.
Here's the rub:

Apart from dereferencing, pointers in C have two extra properties:
they can be NULL, and they can be incremented.

The idea of @t is to handle  the basic case of a non-NULL non-incrementable
pointer. For example

var x: int;
var px: @int = &x;

In theory we now do this: &t pointers cannot be dereferenced, they must first
be converted to @t pointers, which throws if the pointer is NULL. 
More precisely, an &t pointer is a variant:

union pointer[T] = | NULL | Pointer of @T;

match px with 
| NULL => handle_null_case 
| Pointer ?p => handle_object_pointer p 
endmatch

Exactly how to fit all this in is uncertain,
but the idea is to force check.

Another interesting thing about Felix gc system is that malloc'd C pointers
could actually be taken over by the gc (provided they're not free'd).
In particular this would also allow the gc to track the size, so we could
safely implement pointer increments. The only real hassle is that C
allows them to go "one past the end".

Still for Felix &t pointers, we actually can check if they're in-bounds.
So we can do the conversion to @t to allow dereferencing safely
in that case too.


--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to