Page MenuHomePhabricator

eolian: drop class function overriding
ClosedPublic

Authored by bu5hm4n on Feb 9 2019, 12:45 PM.

Details

Summary

Until this commit eo did class functions as part of the vtable, which
enabled those functions to be overwritten in classes inheriting another
class. However in task T7675 we decided that this is not really good for
bindings, as most OOP languages do not support this sort of feature.

After this commit eolian realizes class function completly outside of
the vtable, the c-symbol that is the class funciton is now just directly
redirecting to a implementation, without the involvement of the vtable.

This also means a change to the syntax created by eo:

Calling before:

class_function(CLASS_A);

Calling after:

class_function();

Implementation before:

class_function(const Eo *obj, void *pd) { ... }

Implementation after:

class_function(void) { ... }

This fixes T7675.

Co-authored-by: lauromauro <lauromoura@expertisesolutions.com.br>

Depends on D7900

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bu5hm4n created this revision.Feb 9 2019, 12:45 PM

It seems that this patch has no reviewers specified. If you are unsure who can review your patch, please check this wiki page and see if anyone can be added: https://phab.enlightenment.org/w/maintainers_reviewers/

bu5hm4n requested review of this revision.Feb 9 2019, 12:45 PM

@lauromoura Can you help me a bit ? I cannot find the parts in the c# / cxx bindings that are calling the c symbols, as this needs a update now to not pass any argument ... :)

What about legacy? Is there any legacy class with static methods? Because this might break legacy apps, no?

The only user of this was removed in D7900. Legacy does not use it at all :)

bu5hm4n retitled this revision from eo: drop class function overriding to eolian: drop class function overriding.Feb 10 2019, 12:30 PM
bu5hm4n edited the summary of this revision. (Show Details)
bu5hm4n added a reviewer: q66.Feb 12 2019, 2:29 AM
bu5hm4n updated this revision to Diff 19319.Feb 12 2019, 3:18 AM
bu5hm4n edited the summary of this revision. (Show Details)

update

bu5hm4n edited the summary of this revision. (Show Details)Feb 12 2019, 3:45 AM
bu5hm4n updated this revision to Diff 19325.Feb 12 2019, 4:06 AM
bu5hm4n edited the summary of this revision. (Show Details)

update

q66 requested changes to this revision.Feb 13 2019, 7:06 AM
q66 added inline comments.
src/bin/eolian/headers.c
130

You can rewrite this as just

int nidx = !eolian_function_is_class(fid);

and drop the legacy check and stuff... that is, because nidx will always be 1 when !eolian_function_is_class(fid), regardless of the value of legacy, and conversely it will always be 0 when eolian_function_is_class(fid), regardless of the value of legacy.

This revision now requires changes to proceed.Feb 13 2019, 7:06 AM
bu5hm4n marked an inline comment as done.Feb 13 2019, 7:17 AM
q66 accepted this revision.Feb 13 2019, 7:17 AM
This revision is now accepted and ready to land.Feb 13 2019, 7:17 AM
Closed by commit rEFL37d2d378ec2e: eolian: drop class function overriding (authored by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhyFeb 13 2019, 8:00 AM
This revision was automatically updated to reflect the committed changes.