Type inference + Serializer

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Type inference + Serializer

David Elahee
Hi list,

I used build haxe_r3656.zip and had an issue with this code and FlashDevelop : 


package ;

import haxe.Serializer;
import neko.Lib;

/**
 * ...
 * @author de
 */

 class A<T> extends IntHash<T>
 {
public function new()
{
super();
}
 }

class Main 
{
static function main() 
{
var l_A : A<Int> = new A<Int>();
l_A.set(0, 1);
trace(l_A.get(0));
trace(Serializer.run(l_A) );
}
}

Main.hx:27: 1
Called from StringBuf::$statics line 1
Called from Main::main line 28
Called from haxe.Serializer::run line 411
Called from haxe.Serializer::serialize line 295
Called from haxe.Serializer::serializeFields line 153
Called from haxe.Serializer::serialize line 386
Uncaught exception - Cannot serialize #abstract
Appuyez sur une touche pour continuer...


I am actually really fan of type inference , generics and serialization, so i hope a patch will emerge pretty soon.

Thanks a lot, congrats for your brilliant work and all the fishes.

See ya,
David.


--
David Elahee -+33 6 63 92 55 96
Mad Monkey Studio - Project Manager - R&D Developper
Immeuble Bordeaux Plaza
2, Place Ravezies
33800 Bordeaux

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type inference + Serializer

Nicolas Cannasse
Le 26/01/2011 15:09, David Elahee a écrit :
> Hi list,
>
> I used build haxe_r3656.zip

It will be hard to support directly, you will have to implement your own
serialization using hxSerialize and hxUnserialize for your subclass.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Type inference + Serializer

Simon Krajewski
In reply to this post by David Elahee
If you don't want to write your own serialization methods (although doing so should be easy enough), you can also remove the extends and make the IntHash a member variable of your class.

Simon

Am 26.01.2011 15:09, schrieb David Elahee:
Hi list,

I used build haxe_r3656.zip and had an issue with this code and FlashDevelop : 


package ;

import haxe.Serializer;
import neko.Lib;

/**
 * ...
 * @author de
 */

 class A<T> extends IntHash<T>
 {
public function new()
{
super();
}
 }

class Main 
{
static function main() 
{
var l_A : A<Int> = new A<Int>();
l_A.set(0, 1);
trace(l_A.get(0));
trace(Serializer.run(l_A) );
}
}

Main.hx:27: 1
Called from StringBuf::$statics line 1
Called from Main::main line 28
Called from haxe.Serializer::run line 411
Called from haxe.Serializer::serialize line 295
Called from haxe.Serializer::serializeFields line 153
Called from haxe.Serializer::serialize line 386
Uncaught exception - Cannot serialize #abstract
Appuyez sur une touche pour continuer...


I am actually really fan of type inference , generics and serialization, so i hope a patch will emerge pretty soon.

Thanks a lot, congrats for your brilliant work and all the fishes.

See ya,
David.


--
David Elahee -+33 6 63 92 55 96
Mad Monkey Studio - Project Manager - R&D Developper
Immeuble Bordeaux Plaza
2, Place Ravezies
33800 Bordeaux

--
haXe - an open source web programming language
http://haxe.org