Page MenuHomePhabricator

EFL Interfaces
Updated 1,368 Days AgoPublic

Intro

EFL interfaces is an initiative to clean up and merge a lot of the eo functions in order to make a clean, consistent and predictable API. This will essentially be the API for EFL 2.0.

C API Problem

The Problem

Our API is very redundant, long to type and not very predictable at the moment. A good example is file_set. We have:

elm_obj_image_file_set()
elm_obj_bg_file_set()
elm_obj_layout_file_set()
elm_obj_video_file_set()
elm_obj_photocam_file_set()
elm_obj_thumb_file_set()
elm_obj_photo_file_set()
evas_obj_image_file_set()
edje_obj_file_set()

All share the same parameters and are essentially the same functions, just on different objects. This means we have 9 different functions that essentially do the same thing and that the user has to guess which one to use. This is 9 times more API to learn and remember than needed.

C++ and many other natively-OOP languages easily solve this by making this not matter. That is, "->file_set()" is easy to remember and doesn't need any of the namespacing we require in Eo.

The solution

EFL interfaces. We will create basic interfaces to share behaviours among different classes, and use a common short prefix.

For example, following the file_set example above, we'll create an EFL file interface which defines file_set and make all of those classes implement it. The function that will be created will be:

Eina_Bool efl_file_set(const char *file, const char *group)

which is predictable, short and easy.

In this case, the interface created will be "Efl_Interface_File", and the namespace is "efl_file". The property name is "file" (thus creating "file_set"), and with the eolian c generator merging of duplicate names it'll become "efl_file_set()"

Example Interfaces

  • Efl_Text
  • Efl_File
  • Efl_Geometry?

Eo API Everywhere

Part of this initiative is to add Eo API to things that don't have that at the moment. For example, the ecore mainloop will become an Eo object. Ecore_Con/IPC and etc. will all become Eo objects and use Eo callbacks instead of the global ecore callbacks they use at the moment.

More Information

More information is available in the dev branch: devs/tasn/efl_interfaces on efl.git and elm.git

Issues that need resolving

This is a list of interfaces with issues that need resolving

  • Elm entry and the file interface clash on file_set.
  • Elm image and the image interface clash because of the meaning of "animated".
  • Elm photocam and the file interface clash on file_set.
Last Author
tasn
Last Edited
Apr 23 2015, 3:51 AM
Projects
None
Subscribers
woohyun, thiepha, dk.mishra and 8 others

Document Hierarchy