On 01/04/2011, at 10:12 PM, Rhythmic Fistman wrote:

> I was binding some c code and needed to use null pointer.
> Obviously 0 didn't work (it's an int, not a pointer!) but then I
> remembered c_hack
> and null[T] and did this:
> 
> proc do_something: &long_type_name = "c_do_something($1);";
> 
> var x : long_type_name;
> do_something(&x);
> /* ... */
> do_something(null[long_type_name]);
> 
> Do I really have to type null[long_type_name]? Why can't I just type null?


Because you do :) 

Felix can only deduce types bottom up.

So to overload the function do_something the argument
type must be known, so you have to specify it.

Unlike C++ where there are automatic conversions.

To put this another way, Felix doesn't support polymorphic
constants. This is particularly annoying in typeclasses
where you'd want

typeclass Integer[T] {
        virtual const zero: T;
        axiom add ( x:T, zero ) = x;
}

but if you look in the library we actually have

        virtual fun zero : 1 -> T;

instead ;(

--
john skaller
[email protected]





------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to