[haiku] Re: [GSoC] Python Bindings for the Haiku API

  • From: Niels Reedijk <niels.reedijk@xxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Tue, 30 Mar 2010 22:10:29 +0200

Hi,

On 30 March 2010 21:34, Ankur Sethi <get.me.ankur@xxxxxxxxx> wrote:
> Hi Ryan,
>
> On Tue, Mar 30, 2010 at 3:11 AM, Ryan Leavengood <leavengood@xxxxxxxxx> wrote:
>>
>> But fortunately I have been in contact with a student, Akshay Gupta,
>> who is interested in making a Haiku Ruby binding in much the same way
>> you are interested in doing this Python binding. In fact he has been
>> looking also at Niels' work and I suspect there is some amount of
>> overlap and these projects should probably collaborate to some extent.
>
> Actually, Akshay is an old friend of mine. I'm sure we can collaborate
> and come up with something both the bindings can use.
>
>> In regards to the declarative UI idea, I think it is great, and the
>> general idea of declarative code and Domain Specific Languages (DSLs)
>> is very big in the Ruby community. Though my first choice for a
>> declarative UI language would not be XML, at least not for Ruby.
>> Though I suppose there is something to be said for borrowing some
>> concepts from XUL or XAML.
>
> Perhaps we could settle on a common format and then all bindings could
> use it. What could we use besides XML, though? JSON? S-expressions?
> Perhaps we could take the Cocoa route and compile the XML to a binary
> format. That might be a tiny bit faster but, IMO, introduces some
> complexity.

I was thinking about JSON as well. As for speed, building a UI will
never be the most time consuming task and as such it seems like
overkill to compile it.

There is another way of doing bindings, which is by actually going the
other way around and more or less embedding Python and Ruby inside an
application. It works a little bit like this:

In my opinion, wrapping the UI part of the Haiku API is the most
challenging part for any bindings. If there is a powerful declarative
UI mechanism (in JSON or XML) and there is a C++ parser that
constructs the UIs from that, you can wrap that library both in Python
and Ruby then you have a common declarative UI and you can implement
the rest of the app in a sort of View-Controller(-Model).

Of course you would loose some features (like reimplementing
controls), but that's not necessarily a bad thing: if the Python/Ruby
API would be identical to the C++ API, then why have it?

Regards,

N>

Other related posts: