Ah - okay, if it's serialisation-specific, it's not what I'm looking for. I was looking for an analogue to the C trick of interpreting a block of bits as a struct quickly and efficiently.
martin On Wed, Apr 16, 2008 at 11:16 AM, john <[EMAIL PROTECTED]> wrote: > The idea behind packedobjects is to be able to use an abstract syntax > for describing what gets bit packed into messages to be sent across a > network. The syntax is loosely based on ASN.1 but uses s-expressions > to avoid the need for an ASN.1 compiler. The encoding is based on > unaligned Packed Encoding Rules (PER). So if you are looking at > packing data into messages in a machine independent way it might be > useful. > > Cheers, > > John. > > > > On 16/04/2008, Martin DeMello <[EMAIL PROTECTED]> wrote: > > 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 > > [email protected] > > http://lists.nongnu.org/mailman/listinfo/chicken-users > > > _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
