Page MenuHomePhabricator

efl-mono: Implement Remove() method in eina.List, eina.Array and eina.Value
Open, WishlistPublic


eina.List, eina.Array and eina.Value (for container types) are missing the Remove() method so elements cannot be removed.

segfaultxavi triaged this task as Wishlist priority.
felipealmeida added a subscriber: lauromoura.
lucas added a subscriber: lucas.Feb 7 2020, 12:53 PM

What is the desired behavior:
Should the return be a bool or the removed element?
This method is expected to remove a position or a specific element?

Let's look at what we have in Eina.

  • eina_array does not have a Remove method (only a remove method that works like a filter).
  • eina_list removes a specific element and returns the resulting list (which you probably don't need to do in C#) or NULL.
  • eina_value removes a specific position and returns a boolean.

So, given that we should not be reinventing Eina in C# (because C# already has all this functionality) and the lack of coherence in the Eina API, I'd say you should do whatever feels more "natural" in C#.
Feel free to make a proposal here and let's discuss it.

lucas added a comment.Feb 10 2020, 6:35 AM

I think the most natural in c# would be like in IList format:

  • Remove: remove a specific element and return a boolean
  • RemoveAt: remove by index and without return.

Looking at src/list/eina/eina_{list,array}.h, src/list/eina/eina_inline_{list,array}.h,
src/list/eina/eina_in{list,array}.h and src/list/eina/eina_value.h we already have native functions at
eina_value.h to implemente a Remove for lists and arrays.
For a RemoveAt for arrays we can use the eina_inarray_ramove_at at eina_inarray_h.
For a RemoveAt for list I think we can use the eina_list_nth at eina_list.h to get at the index and remove it.
So I think we can implement both removes that IList does, but I have no idea on which one is better for us.
A Remove would be easier to do.