flash.Vector versus haxe.ds.Vector

89 views
Skip to first unread message

Lea Hayes

unread,
Aug 21, 2013, 4:58:33 PM8/21/13
to haxe...@googlegroups.com
Hey guys

When using OpenFL it seems that there are two different implementations of the vector collection; flash.Vector and haxe.ds.Vector.

The only difference which I have found is that the flash variation supports fixed and variable length collections whereas the haxe.ds variation is always fixed length. Are there any other notable differences which I am missing?

In both cases people have told me to use the other. I am a little confused as to which one I should be using, and perhaps more importantly, why :)

Use flash.Vector not haxe.ds.Vector!

Use haxe.ds.Vector because flash.Vector is just for OpenFL

Does this just mean that the flash one should be used when using OpenFL because it is a tiny bit more capable than the other version? or perhaps that extra capability comes at some cost and I should just use the haxe.ds version...

Cheers!

Jordan Wambaugh

unread,
Aug 21, 2013, 6:36:44 PM8/21/13
to haxe...@googlegroups.com
I think it depends on your project, and what you're using the Vectors for.
If you project is purely openFL, and this code won't need to every be compiled without openFL (like in server code for example) then go ahead and use flash.Vector.
However, for max portability, if there will be cases where you won't be using openFL, then use haxe.ds.Vector instead.
I am unsure if a flash library expecting a flash.Vector will/can cast a haxe.ds.Vector automatically and just work, so that's another thing to keep in mind.

TopHattedCoder

unread,
Aug 21, 2013, 6:38:31 PM8/21/13
to haxe...@googlegroups.com
flash.Vector on native OpenFL just abstracts over Array. haxe.ds.Vector is faster on Neko, C++, Java and C# as far as I'm aware. They both have the same implementation on Flash, however, for obvious reasons.

Lea Hayes

unread,
Aug 21, 2013, 6:55:51 PM8/21/13
to haxe...@googlegroups.com
Thanks guys!

So I think I will stick with haxe.ds.Vector since C++ is the primary target for my project :)
Reply all
Reply to author
Forward
0 new messages