Page MenuHomePhabricator

eo: add helper for basic property type reflection.
AbandonedPublic

Authored by cedric on Feb 13 2019, 10:51 AM.

Diff Detail

Repository
rEFL core/efl
Branch
devs/cedric/reflection
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 9503
cedric created this revision.Feb 13 2019, 10:51 AM

Can we have testcases / usecases for this function ? I don't see its value right now tbh ... :(

Can we have testcases / usecases for this function ? I don't see its value right now tbh ... :(

I am not sure of this one yet. I think of using it with an additional macro from within the .eo.c to have something like :

EFL_PROPERTY_DEFINE_SET(efl_name, string);
EFL_PROPERTY_DEFINE_GET(efl_name, string);

With :

#define EFL_PROPERTY_DEFINE_SET(Func_Name, Type) \
    static Eina_Error                            \
    _efl_property_##Func_Name##_set(Eo *obj, Eina_Value value) \
    {                                            \
          return efl_property_##Type##_set(obj, value, Func_Name##_set); \
    }

Along with a macro for the class initializer like:

#define EFL_OBJECT_OP_PROPERTY(Name, Func_Name_Get, Func_Name_Set) { #Name, _efl_property_##Func_Name_Set, _efl_property_##Func_Name_Get }

The change I could do, but I am really not sure of, is to change the macro to actually provide an inline function and avoid the function call indirection. This would be slightly more efficient in term of speed, but might use slightly more space on disk.

bu5hm4n requested changes to this revision.Feb 14 2019, 2:21 AM

@cedric i still fail to see the reason for this, the code for the reflection can just be generated in eolian. Such a macro in public userspaces looks like this should be used from userland? If you are in userland, then you can just use efl_property_reflection_set efl_property_reflection_get and thats it ... :)

This revision now requires changes to proceed.Feb 14 2019, 2:21 AM
segfaultxavi requested changes to this revision.Feb 14 2019, 4:07 AM
segfaultxavi added inline comments.
src/lib/eo/Eo.h
902

If this is to be used, it needs docs.

@cedric i still fail to see the reason for this, the code for the reflection can just be generated in eolian. Such a macro in public userspaces looks like this should be used from userland? If you are in userland, then you can just use efl_property_reflection_set efl_property_reflection_get and thats it ... :)

I want to generate the smallest amount of code and rely on macros as much as possible. My reasoning here is that as we add more type helper, the generated code is going to get more and more complex. I find it hard to have to deal with generated code as their is no type checking or anything when dealing with string. Also we do everything in C, it makes the writing of code kind of harder than it would be if we had a template language. I fell that relying on macro kind of offset that problem.

cedric abandoned this revision.Feb 15 2019, 2:04 PM