Re: [E-devel] EO compositing "leaking" interfaces

2019-10-26 Thread Tom Hacohen
That's part of the problem I described in
https://phab.enlightenment.org/T8184 and specifically mentioned this. Eo
is doing nothing wrong, it's working as designed, it's the new
restrictions that were added only to Eolian that are wrong and made
things inconsistent.

Eo doesn't even have a concept of interfaces internally so doing what
you are suggesting will involve some code (specifically saving the
interfaces on the classes and using them). Eo also has the debug binary,
so it can easily be added for eo_debug, just someone needs to do it.

I still maintain however, that the correct thing to do is to unbreak
eolian and revert compositing to how it was..

--
Tom

On 24/10/2019 01:48, Lauro Moura wrote:
> Talking today about some examples using the new API we came up with the
> following situation:
> 
> ```
> Eo *_screen = efl_add(EFL_UI_TEXT_CLASS, ...);
> ...
> Efl_Text_Cursor_Cursor *cursor = efl_text_cursor_get(_screen,
> EFL_TEXT_CURSOR_GET_TYPE_MAIN);
> ```
> 
> The call seems to succeed in C but it is a compilation error in C#, as
> `Efl.Text_Cursor` is not in the inheritance/interface tree of `Efl.Ui.Text`.
> 
> What seems to be happening is:
> 
> * `Efl.Ui.Text` composites with `Efl.Text_Interactive` and `Efl.Text_Markup`
> * `Efl.Ui.Text` internally uses `Efl.Ui.Internal.Text.Interactive` as a
> composite
> * `Efl.Ui.Internal.Text.Interactive` implements `Efl.Text_Interactive`.
> * This satisfies `composite_attach` requirement and will forward the
> `efl_text_interactive` calls to the composite object.
> * `Efl.Ui.Internal.Text.Interactive` *also extends* `Efl.Text_Cursor`
> through `Efl.Canvas.Text`
> 
> Given this, C code seems them to be able to call `Efl.Text_Cursor` methods
> on the `Efl.Ui.Text` instance through its composite, even though
> `Efl.Ui.Text` has no idea `Efl.Text_Cursor` exists.
> 
> This may work in C (but should it?) as we just pass `Eo*` around and do the
> actual checks at runtime, but for strongly typed languages like C# this
> means the generator has no way to know text cursor methods would be
> available through composition and trying a similar code would lead to
> compilation errors.
> 
> Shouldn't Eo somehow (debug build if too expensive?) intercept these calls
> and emit a warning to avoid such usage?
> 
> (For this particular case, a fix could be making `Efl.Ui.Text` declare
> `Efl.Text_Cursor` as a composite, right?)
> 


___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] EO compositing "leaking" interfaces

2019-10-23 Thread Lauro Moura
Talking today about some examples using the new API we came up with the
following situation:

```
Eo *_screen = efl_add(EFL_UI_TEXT_CLASS, ...);
...
Efl_Text_Cursor_Cursor *cursor = efl_text_cursor_get(_screen,
EFL_TEXT_CURSOR_GET_TYPE_MAIN);
```

The call seems to succeed in C but it is a compilation error in C#, as
`Efl.Text_Cursor` is not in the inheritance/interface tree of `Efl.Ui.Text`.

What seems to be happening is:

* `Efl.Ui.Text` composites with `Efl.Text_Interactive` and `Efl.Text_Markup`
* `Efl.Ui.Text` internally uses `Efl.Ui.Internal.Text.Interactive` as a
composite
* `Efl.Ui.Internal.Text.Interactive` implements `Efl.Text_Interactive`.
* This satisfies `composite_attach` requirement and will forward the
`efl_text_interactive` calls to the composite object.
* `Efl.Ui.Internal.Text.Interactive` *also extends* `Efl.Text_Cursor`
through `Efl.Canvas.Text`

Given this, C code seems them to be able to call `Efl.Text_Cursor` methods
on the `Efl.Ui.Text` instance through its composite, even though
`Efl.Ui.Text` has no idea `Efl.Text_Cursor` exists.

This may work in C (but should it?) as we just pass `Eo*` around and do the
actual checks at runtime, but for strongly typed languages like C# this
means the generator has no way to know text cursor methods would be
available through composition and trying a similar code would lead to
compilation errors.

Shouldn't Eo somehow (debug build if too expensive?) intercept these calls
and emit a warning to avoid such usage?

(For this particular case, a fix could be making `Efl.Ui.Text` declare
`Efl.Text_Cursor` as a composite, right?)

-- 
Lauro Moura
Expertise Solutions
"lauromoura" on FreeNode

___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel