[haiku-development] Re: Scripting languages

  • From: Donn Cave <donn@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 16 May 2011 08:15:39 -0700 (PDT)

Quoth Sean Healy <jalopeura@xxxxxxxxxxx>,
...
> I consider Java and similar languages to lie somewhere between scripting 
> languages and ordinary programming languages. They are compiled to a 
> binary format, but it is not native machine code, and still needs an 
> interpreter to run it.

That could apply to Python as well.  I don't know anything about it,
but I see there's a "developmentjava" package.  If Java is in any
way near available on Haiku, I would think access to the API would
be a very high priority.

> Even though the project was originally intended to allow scripting 
> languages to access the Haiku API, that is because I assumed that those 
> languages would be the most suitable targets. I assumed (apparently 
> wrongly) that if someone were going to be using a compiled language, 
> they'd just use C++ and have direct access to the API.

There is also a Haskell interpreter, "hugs" - but of course no one
would use it for an application, if a compiler is available.

> Can you point me to any documentation on how to enable access to a C++ 
> API from Haskell?

http://www.haskell.org/haskellwiki/Cxx%5Fforeign%5Ffunction%5Finterface

I took the approach described there as "seems to be the standard
technique", essentially a C wrapper for everything.  I see someone
has had enough success calling the mangled functions directly to
offer a little writeup, but I imagine that would be a waste of time.
In the end, you will want the wrappers anyway for type conversions,
pointer dereferences etc.

        Donn

Other related posts: