Interesting post on one of the advantages of C++ - I just wondered how such problems are handled in the scheme world
------------------------------------------------------------------------------------------------------ What you can do in C++ that you *can't* do in Java is define a class whose in-memory representation maps directly to the format of data in memory, and then say "I want to treat this large swath of memory as if it were an array of Foo objects" - and gain all of the abstraction of calling object methods on that data, with zero performance penalty for instantiating thousands of objects. It's not something you want to do every day, but on the rare occasion you need it, C++ comes closest to letting you have your cake and eat it too. -- Avdi Grimm on the pragmaticprogrammers mailing list ------------------------------------------------------------------------------------------------------ I ran into this exact problem when trying to access a packed C data structure from OCaml - I had to write a bunch of code to index into the block, pull out a chunk of bytes and then write accessor functions to do bitshifting and bitmasking to retrieve the individual members from the struct, without much "higher level" help from OCaml. I'm imagining some combination of C and chicken would do a nicer job of this, and naturally I'd want to do it with as little C as possible. I found http://chicken.wiki.br/packedobjects but I couldn't tell if it could work directly with a block of memory or it there'd be a lot of from/to overhead. martin _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users