Re: [Vala] Interfacing various languages



i think that before accepting patches we need a plan. We have to decide
if we want a subset of Vala, or just to define an interoperability API to
call other languages like C++, Java or ObjC.

if the plan is to use it just with bindings one can use Valabind, which can
create JNA/JNI or C++ bindings from Vala code (still wip) and then just use
that api from Java or C++ code.

But I would prefer to be able to call OBJC/C++ code from Vala. The emscripten
solution to that problem is quite elegant, so maybe we can use it as a way
to create formatted strings at compile time for the generated code. For example:

using Interop;

void main() {
    string msg = "Hello World";
    Interop.cpp ("std::cout << ", msg, ";");
}

This will create the following code:

std::cout << msg; which is valid C++ code, and therefor we can compile the
generated c code from Vala using G++.

The same can be used for ObjC, but it would be great if we could use a more
idiomatic way for that. The vala-objc fork used to completely replace glib
with objc apis, so a 'class lala' would be compiled into a .m file that can
be compiled with an objc compiler.

So we can have different approaches to this problem:

* Transpile to other target languages (java, objc,..)
* Permit a more complete code generation to call C, C++ and ObjC apis
* Generate bindings for other languags (already done with valabind)
* Create wrapper code to wrap C++/ObjC classes into glib ones.
* Create a sub-language of Vala that can be used for portable code
* Make different profile targets to handle different runtimes (glib, posix,.. that's how this was done in the past) * Extend the compiler with a plugin API to handle different codegen backends.

What do you think? After some disucssion I would suggest to open a pad
and continue the design discusison there.

--pancake


On 11/08/2014 01:15 PM, Luca Bruno wrote:
Talking in general here. I would accept patches in the vala compiler for multiple targets only if they are generic enough. It's a long iteration, but I don't want after N months of inactivity of a target to revert it because nobody maintain it.

For this reason, I accept small patches, step by step, to generalize the current vala compiler and codegen to allow more pluggability. I'm not willing to merge big stuff at once especially if those are invasive and do not permit a generic reuse of the compiler.

You have my support for merging the stuff in Vala, but really it must be generic so that maintainability is not a problem in the future.

On Sat, Nov 8, 2014 at 1:10 PM, Marek Gibek <gibekm gmail com <mailto:gibekm gmail com>> wrote:

    Hi!

    I'm thinking of doing the same thing - use Vala to target Android,
    iOS, Windows Phone but also Windows and Linux at the same time!

    But I do not think that compiling to Java on Android or to objective c
    on iOS is required. We can simply create a native library from
    application code with standard vala->c->bin compilation process. And
    then write specific wrapper/library loader in Java/objective-c only if
    it's not possible to do it in C.

    That would require to port glib and gobject to every platform. Thanks
    for info about posixvala - this can be useful.

    I would go even further and I want to prepare the same API wrapper for
    all platforms. That would allow me to write code once and recompile
    for every platform. Abstraction of UI library will be more time
    consuming. Probably creating new one in OpenGL is an option here. As a
    bonus you can run the same app from the same code everywhere.

    I updated Vala plugin for MonoDevelop that runs fine on both
    Windows and Linux:
    https://github.com/marek-g/ValaBinding

    Now I'm working on more complex solution based on IntelliJ - the best
    IDE I am aware of. But it is not open-source for now.

    Actually it requires great amount of work. My dream is to find a
    sponsor or company that could hire me full-time and give me a small
    team to lead to create complete product. If someone is interested,
    this is my linked-in profile:

    http://pl.linkedin.com/in/marekgibek

    I think there is strong need on the market for such product!

    /Marek
    _______________________________________________
    vala-list mailing list
    vala-list gnome org <mailto:vala-list gnome org>
    https://mail.gnome.org/mailman/listinfo/vala-list




--
www.debian.org <http://www.debian.org> - The Universal Operating System



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]