Page MenuHomePhabricator

Eo
Updated 360 Days AgoPublic

This document will eventually describe using Eo, as a first step, it describes my (@tasn) proposed syntax for Eo (Eo 4) and relevant information.
This plan has been largely implemented as the core of our new Unified EFL and you can find the API reference documentation at https://www.enlightenment.org/develop/api/.

Introduction

@felipealmeida and I (@tasn) have been discussing Eo a few months ago, and since we were both displeased with some of the limitations the current design had (mainly eo_do_ret, TLS and the stack), we decided to investigate further and see if we can improve Eo and solve all of those issues without hurting performance or syntax.
Luckily, we managed to find a solution that does all of that, improves the Eo syntax and improves the performance with very minor drawbacks.
I'll be migrating the EFL + ELM to it in the coming weeks. This should be the last Eo revision, as we plan on releasing Eo and Eo APIs as stable in the next few months.

Summary

The new proposed API makes Eo calls look like normal C functions (they are in fact normal c functions), eo_super has a new cleaner syntax, and we have some other improvements in the pipeline, especially for functions that refer to parts like "efl_text_part_text_set".
In practice, this means the eo_add syntax will change a little, and the eo_do set of functions will be removed.

Changes to syntax:

Calling functions

eo_do(obj, a_set(1), b_set("text"));

Changes to:

a_set(obj, 1);
b_set(obj, "text");

Calling "part" functions

eo_do(obj, a_set(1), a_part_set("part", 2));

Changes to:

a_set(obj, 1);
a_set(efl_part(obj, "part"), 2);

Calling "super" functions

eo_do_super(obj, PARENT_CLASS, a_set(1));

Changes to:

a_set(eo_super(obj, PARENT_CLASS), 1);

Calling "super" "part" functions

eo_do_super(obj, PARENT_CLASS, a_part_set("part", 1));

Changes to:

a_set(eo_super(efl_part(obj, "part"), PARENT_CLASS), 1);

Calling eo_add

obj = eo_add(CLASS, parent, efl_text_set("bla"));

Changes to:

obj = eo_add(CLASS, parent, efl_text_set(eo_self, "bla"));

IMPORTANT NOTICE: It's only legal to call efl_part and eo_super once each for every function call, only for the "obj" parameter, and only inside the parameter list.

obj_s = eo_super(obj, PARENT_CLASS);
a_set(obj_s, "bla");

is NOT allowed.

efl_part returns a real Eo object which is valid for a single function call (as the obj). It is possible to ref it and keep it alive for successive function calls, unlike eo_super which is not a real object.

Last Author
ajwillia.ms
Last Edited
Jan 25 2018, 8:10 AM
Projects
None
Subscribers
tasn, felipealmeida

Document Hierarchy