Using Data In-Place

Russ Ross posted a question to the LL1 list, asking about any research people have done into allowing higher-level languages to use data structures from other higher-level languages in place. He points out that this is a strength of C -- you can take a pointer to the other language's memory, cast it to whatever type you want, and then go at it. But most high-level languages have their own requirements for how memory is laid out at runtime, and these requirements are almost always subtly different for each implementation.


There are several ways to address this issue. You can convert the data structures from one format to another, by making a copy. Unfortunately in order to do this you probably have to write your converter in C, because the source and target languages probably don't offer enough control over memory layout.

Another technique is to use a common virtual machine, like the JVM or Parrot. If the VM has sufficiently high-level semantics, then language implementations won't have to think up their own (incompatible) implementation technique, and they will be able to interoperate. You can think of C as being a degenerate version of this technique, where the VM is the CPU itself. That's why C is so good at handling data structures from other languages -- they both use the same CPU model.

A third technique is the one that Russ is asking about: find some way of explaining the foreign semantics of the source language in a way that the target language can understand and use directly. This would add a whole lot of sophistication to your language implementation, and quite possibly make it too much of a headache to bother with. It would impact your compiler as well as your runtime libraries, and it would require that the compiler make a distinction between the behavior of a program, and how that maps to runtime implementation. It might even require that you have multiple versions of each runtime implementation, and that all the versions are capable of interoperating in the same address space. This is clearly not trivial.

Even assuming you can handle the implementation difficulties, you still have the difficulty of finding a way to describe the semantics of a foreign language implementation. Can you imagine explaining Haskell's implicit lazy evaluation to an imperative language like Scheme? How about explaining Parrot's continuation passing implementation to a stack-based implementation like Python? Explaining garbage collection to a language that uses explicit memory management?

Posted on December 10, 2003 12:32 PM
More languages articles

Comments

Eliminating the need for the extra trouble to wear ugg boots uk
ugg boots saleuggs, in the extreme sports, look for happiness in life, with UGG Classic boots and nike sb showed off your tall body, do not worry about being laughed at, dancing new style ugg australia and nike sb dunk . The flavor of life that is colorful, there are Christian Louboutincheap nike dunksUGG cardy boots、and nike sb for sale also used fear to creep away money from your pocket Mody ? Love beauty, you might even love UGG Classic tall bootsUGG Nightfall bootsUGG Classic short bootsnew nike sb

Posted by: ugg boots sale at November 12, 2009 03:36 AM

Uggs on sale now.UGG Classic Cardy Boot makes me different form the other

girls. The UGG Bailey Button Boot is a good choice for female.

Posted by: ugg classic cardy boots at November 17, 2009 12:51 AM

The 39.html">classic cardy uggs boots is another hot boots that worth of buying.And the classic tall ugg boots
will make your winter amusing.And now uggs on sale,if you are looking for such a boot,the ugg boots is good choice this year.

Posted by: UGG Bailey Button Boots at November 17, 2009 01:03 AM

Louis Vuitton , commonly referred to as Frequently Asked Question and About Louis Vuitton website Gifico.com, or sometimes shortened to Shipping and Tracking has become one of the most Privacy Statement Agendas luxurybrands Return & Exchange policy.

Posted by: 1 at November 17, 2009 02:20 AM

We are the best online sales for the china wholesale . Here you can have a large of choices of kinds Ugg Boots,Converse Shoes,Timberland Boots,puma shoes,Nike Shox Shoes ,Nike Dunk SB Shoes,Nike Air Max,Links Of London,Tiffany Jewelry,Dior Handbags?,jimmy choo handbags ,Cartier Watches, 8GB Mp4 Players,Bluetooth Car DVDs. All our cheap online cheap goods are high quality and original packages, and best service. We offer our customers the best service, 7 days arrive at your door.Enjoy your easy and happy shopping with us.

Posted by: cheap goods sale. at November 20, 2009 01:34 AM

People all over the world know the abercrombie and fitch,but not everyone really knows how fashion the abercrombie is,hollister is the Legend maker. Everybody wears the hollister clothing would be the abercrombie mens and the abercrombie womens, if you want know you can search the Ruehl No.925 or abercrombie outlet in the www.google.com .

Posted by: fitch at November 21, 2009 03:37 AM

Laptop Battery Laptop Battery Laptop Batteries
Laptop Batteries discount laptop battery
discount laptop battery
notebook battery notebook battery
computer battery computer battery
replacement laptop battery replacement laptop battery
notebook batteries notebook batteries

Posted by: Laptop Battery at November 24, 2009 10:11 PM

Ugg Classic Cardy

Boots

Ugg Classic Tall

Boots

Ugg Classic Short

Boots

Posted by: topuggshoes at November 26, 2009 03:00 AM

Just wanted to say great job with the blog, today is my first visit here and I’ve enjoyed reading your posts so far
ugg bailey button
Wow, my ugg classic mini will not be coming off now! I’ve had them on for 12hrs strait and I do not want to take them off. Thanks for everything, well worth the wait.

Posted by: ugg bailey button boots at November 30, 2009 05:59 AM
Post a comment









Remember info?




Prove you're human. Type "human":