On Tue, 2006-09-26 at 21:47 +1000, Jonathan Kelly wrote: > Hi, > > am I right in deducing there are no arrays in felix, despite the > temptingly titled sections in the tute and ref man? I mean the sort of > arrays a C/C++ programmer would be thinking of, obviously.
Felix has first class fixed length arrays whose length is determined by a compile time constant, exactly the kind in this C: #define n 1000 struct X { int array[n]; } It also has C style arrays: module Carray { requires cstdlib; open C_hack; fun array_alloc[t]: int -> ptr[t] = '(?1*)std::malloc(sizeof(?1)*$1)'; .... which are unsafe and can't contain Felix heap pointers. You can also use STL vector of course, but again only for C++ data types or pointer-free Felix ones. We're working on a fixed length array whose length is determined at construction time dynamically, called 'varray' in module Varray. And possibly also a dynamically extensible array like STL vector. The difficulty here is that there are LOTS of different options. Some are hard, for example an extensible array which moves its storage around: the way STL handles this is very inefficient. Using mmap/realloc is much faster, but C++ does not provide a move or 'relocate' method for objects: realloc doesn't work with copy ctor. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language