I have varray serialisation appearing to work. Sans pointers, but
this is cool : everything on the heap is a varray.

However I found a weird bug I can't explain (in the compiler).

This works:

    var mydecoder = shape.decoder;
    for var slot in 0uz upto usedslots - 1uz do
      i = mydecoder ( p + slot * dynamic_slot_size, s, i);
    done

Note that shape.decoder is a C function of type

        address * +char * size --> size

The generated code is:
      _i44919_v44919_mydecoder = _i44912_v44912_shape->decoder; //assign
..
      _i44911_v44911_i = _i44919_v44919_mydecoder(
           (void*)((char*)_i44918_v44918_p+(_i44920_v44920_slot * 
_i44917_v44917_dynamic_slot_size )),
         _i44910_v44910_s, 
          _i44911_v44911_i); //assign

But this does not work:

        i = shape.decoder  ( p + slot * dynamic_slot_size, s, i);

It generates this C++:

      _i44905_v44905_i = _i44906_v44906_shape->decoder; //assign

which is a type error. Somehow the argument of the function just got lost!

What we have here is a bit interesting I admit: the function "decoder" here is
curried:

        decoder shape ( p + slot * dynamic_slot_size, s, i)

it has type:

        gc_shape_t -> (address * +char * size --> size)

however the first arrow is a Felix function and the second arrow 
is a C function. More interesting, decoder is given by

        fun decoder: gc_shape_t -> decoder_t = "$1->decoder";

in other words it isn't really a function, its a macro. 


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




------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to