On Tue, Dec 6, 2016 at 10:11 PM, Jean-Philippe André <j...@videolan.org> wrote:
> On 6 December 2016 at 13:33, Conrad Um <con...@gmail.com> wrote:
>> I'm a big fan of vala (if you don't know what vala is, please see this link
>> <https://wiki.gnome.org/Projects/Vala>), and writing a vala binding
>> generator for EFL.
>>
>> Vala has a syntax similar to C# and has managed feature based on reference
>> counting, but basically it just converts .vala files to .c files to compile
>> them with gcc and gobject library.
>>
>> My experimental generator can create VAPI files for having vala recognize C
>> APIs, but only support compact class type which is not a full-featured vala
>> class type.
>> (Because complete vala class is based on gobject system. You can see the
>> difference of compact and complete class here
>> <https://wiki.gnome.org/Projects/Vala/FAQ#What_does_.5BSimpl
>> eType.5D_and_.5BCompact.5D_in_bindings_mean.3F>
>> .)
>> If I want to use all features supported in vala, I should make a wrapper
>> class like in eolian_cxx.
>>
>> By the way, it comes to my mind that makes vala generate c code based on eo
>> instead of gobject. It can be used by application developers, but I think
>> even EFL developers can write libraries with modern language.
>>
>> Currently, we should write 2 files (.c and .eo) per class at least.
>> However, vala with eo backend only requires 1 vala file.
>>
>> For example,
>>
>> public class Elm.Button : Elm.Layout, Efl.Ui.Clickable,
>> Elm.Interface.Atspi_Widget_Action
>> {
>>    /* elm_widget_button.h, contents of private header */
>>    private double ar_initial_timeout;
>>    private double ar_gap_timeout;
>>    private Ecore.Timer? timer; // question mark means nullable
>>    private bool repeating;
>>
>>    /* events */
>>    public signal void clicked();
>>    public signal void repeated();
>>
>>    /* elm_button.c, property setter/getter body */
>>    public bool autorepeat {
>>       set {
>>          timer = null; // To assign null to 'timer' will unref timer.
>>          autorepeat = value;
>>          repeating = false;
>>       }
>>       get {
>>          return autorepeat & admits_autorepeat;
>>        }
>>    }
>>
>>    /* elm_button.c, private function body */
>>    private void activate() {
>>       timer = null;
>>       repeating = false;
>>       /* if property getter is set, the next condition will be (!disabled
>> && !freeze_events) */
>>       if (!disabled_get() && !freeze_events_get())
>>          clicked(); // invokes callbacks for "clicked" events
>>    }
>>
>>    /* elm_button.c, override Efl.Canvas.Group.group_add() */
>>    public override group_add() {
>>       base.group_add(); // efl_super
>>       sub_object_parent_add();
>>
>>       /* lambda expression */
>>       resize_obj.signal_callback_add("elm,action,click", "*", (emission,
>> source) =>
>>       {
>>          activate();
>>       });
>>
>>       access_object_register(resize_obj);
>>       can_focus_set(true);
>>
>>       theme_set("button", "base", style_get());
>>    }
>>    ...
>> }
>>
>> With vala file like above, valac (vala compiler) with eo backend will be
>> able to generate several files we need. (public header, private header, c
>> file including .c and .eo.c contents)
>> Moreover, header and c files generated by valac are simple c source files,
>> so they can be compiled with existing code or c file written in c from the
>> beginning (not generated).
>> I know all EFL developers are C expert, and you may never feel need of
>> redundant tools except for C. However I think if you want EFL to advance
>> further and continuously, we should investigate how we can adapt modern
>> concepts, knowledge and ideas on our works.
>>
>> It's just a suggestion, but if there is any one interested in this idea, we
>> can start new project for the future. :D
>
> I was wondering when you would go public with your idea :)
> Will you publish your current code somewhere? You have a private repo on
> git.e.org.
>
> I think this is really cool as it seems to generate a (almost?)
> zero-overhead binding in a friendly language.
> I know nothing about C# or Vala, although I know they only look similar,
> they are not the same language.

I haven't played myself with Vala, but the example you are sharing
with us is quite nice. In general my position hasn't changed, we must
support as many language as possible and as well as possible. That is
the point of our work on EFL interface and moving so massively to eo.
So I would welcome a new binding like vala to sit in efl/src/bindings
along with c++, js and lua (I also hope to see one day Python and many
others there). Please share your work with us !

> I doubt we would use this inside the EFL codebase itself but I can
> definitely see the value in a new language binding.

I agree with you on this completely.

> If only the EFL interfaces could be completed already...

I also agree on this. Hopefully we will be done some time next year.
-- 
Cedric BAIL

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to