language-interoperability

Polyglot Programming is Coming? How?

I'd love to have the freedom to use various languages for the problems they work best for but I'm not sure how this can be accomplished today. I have had a fair amount of success using web services as the language abstraction layer and that works great... but it's slower than molasses even using localhost. Steve Yegge has talked about ...

About using F# to create a Matrix assembly usable from C#

There are no builtin matrix functions in C#, but there are in the F# powerpack. Rather than using a third party or open source C# library, I wonder about rolling my own in F#, and exposing the useful bits to C#. Wondered if anybody has already thought of this, or tried it, and whether it's a good idea. Should I expose it as a class, ...

Calling Java from Clojure

When I try to run the following code (from the REPL) in Clojure: (dotimes [i 5] (.start (Thread. (fn [] (Thread/sleep (rand 1000)) (println (format "Finished %d on %s" i (Thread/currentThread))))))) I get the following error: java.lang.Exception: Unable to resolve symbol: i in this context clojure.lang.Compiler$C...

How can I pass data from Perl to Java?

I'm working on some Java <-> Perl interaction. I would like to know what the best way is to pass information from Perl to Java. (Great answers about Perl and Java here and here btw). There's a lot of text and XML(XML::Twig) I'm parsing in Perl, in a script I'm supposed to call from a Java Web App. So I have all this gathered data, and I...

Is it possible to call a C function from OCaml passing a huge array efficiently?

I'm considering the use of a combination between OCaml and C code in a new application. It seems that calling C code from Ocaml is simple: external name : type = C-function-name However, it seems also that in the other way around (calling OCaml from C) is more complicated: static void call_ocaml_void (const char * name) { ...

How to convert from from java.util.Map to a Scala Map

A Java API returns a java.util.Map<java.lang.String,java.lang.Boolean>;. I would like to put that into a Map[String,Boolean] So imagine we have: var scalaMap : Map[String,Boolean] = Map.empty val javaMap = new JavaClass().map() // Returns java.util.Map<java.lang.String,java.lang.Boolean> You can't do Map.empty ++ javaMap, because t...

Implementing unsafe Java interfaces

I've ran into a problem recently while developing with Spring Security. It has an interface GrantedAuthority with following signature: public interface GrantedAuthority extends Serializable, Comparable And as for Java 1.5 and later, the interface Comparable takes a type parameter T, which is omitted in Spring Security libraries (obvio...

Embed bash in python

Hi, I am writting a python script and I am running out of time. I need to so some things that I know pretty well in bash, so I just wonder how can I embed some bash lines into a python script. Thanks ...

What are the best practices in language interoperability?

In a system which requires use of multiple languages, what are the best practices to ensure a loosely-coupled architecture when code is calling another language's code? ...

What's the best way of accessing a DRb object (e.g. Ruby Queue) from Scala (and Java)?

I have built a variety of little scripts using Ruby's very simple Queue class, and share the Queue between Ruby and JRuby processes using DRb. It would be nice to be able to access these from Scala (and maybe Java) using JRuby. I've put together something Scala and the JSR-223 interface to access jruby-complete.jar. import javax.script...