[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mapping data



At 12:52 PM -0500 12/10/03, Kimberley Burchett wrote:
>On Tue, 9 Dec 2003, Russ Ross wrote:
>
>>  One of the barriers to using lightweight languages for many
>>  low-level tasks is the difficulty in interfacing with data from an
>>  outside source.  C is pretty good at this since you can define a
>>  data structure (including C's union types) and map it to memory that
>>  came from anywhere.  I'm curious about other solutions to this
>>  problem, particularly in integrating with the type systems of high
>  > level languages.

[Snippage]

>However it sounds like you want some kind of procedural mechanism, or
>static type-system, that will let one language "understand" how to work
>with other another language, *in place*.

It's also possible he's looking for something a bit less complex, or 
at least a more restricted subset of the problem--turning a random 
blob of memory into something more structured without having to write 
custom C (or other relatively low-level language) code to do it. It's 
definitely a pain to map something like:

  struct {
     int foo;
     double bar;
     char baz[15];
  }

into perl without either custom C code or nasty pack and unpack work. 
It's a really major hassle once you start getting pointers to 
structures (and pointers to arrays of pointers to structures of 
arrays of pointers of something or other) in there.

In general it's doable with simple text descriptions of the 
structures (which the C definitions just happen to be :) but in 
specific it always seems to turn out to be a major pain and awfully 
slow on top of it.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk