bastibe / lunatic-python

A two-way bridge between Python and Lua
http://labix.org/lunatic-python
GNU Lesser General Public License v2.1
301 stars 82 forks source link

How I can make a Lunatic-Ruby? #73

Open xskullcrow opened 4 years ago

xskullcrow commented 4 years ago

Hi, I used Lunatic Python to make the Love framework compatible with Python, but right now I want to do the same but instead of Python with Ruby, it has its own C Api, although different from Python or Lua, but is it possible to make a Lunatic Ruby?, that is, in the same way that Lunatic Python was made, but with Ruby, how can I do it?

greatwolf commented 4 years ago

I'm not familiar with the Ruby C api but I'd assume it provides all the tools and functions you'll need to get at Ruby's language features and semantics. I don't see why Lunatic-Ruby isn't possible, it's just a matter of learning and getting familiar with the api and build a bridge with it.

There is the issue of data type mapping and translation; at some point you'll have to decided how you want to handle it from the foreign language. Some of the types are self explanatory, like value/ non-reference types eg. numbers, bools, nil, null, strings etc. But what about other things like functions, closures, array list-type containers, coroutines etc. In lunatic-python most of the latter is handled by wrapping a reference to it in some meta-object and you use that object through that meta-object.