Page MenuHomePhabricator

C#: Mark protected methods as protected
Open, HighPublic

Description

Currently, protected methods are being generated as public.

lauromoura triaged this task as TODO priority.
woohyun added a subscriber: woohyun.Jan 8 2019, 9:43 PM

@lauromoura

I know you are very busy, but -
please care about this problem together :)

lauromoura raised the priority of this task from TODO to High.Mar 15 2019, 7:38 AM
YOhoho added a subscriber: YOhoho.Jun 19 2019, 1:23 AM

I tried to write patch to support eo access modifiers(like @protected) on EFL#. however there is a problem.
Method of C# interface have to be public.

Interface members are automatically public, and they can't include any access modifiers. Members also can't be static. (https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/interfaces/index)

but there is protected method of Eo interface. e.g. hint_size_restricted_min_set. you will get CS0106 Compiler error.(https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0106)

I have no idea how to solve this problem.

I think this is (again) an example of something that EO supports and one of the binding languages does not.

I see two options:

  1. Make the C# generator ignore @protected tags in interfaces.
  2. Modify Eolian so that it does not accept @protected tags in interfaces, and then we remove that tag from hint_size_restricted_min_set.

I agree with Microsoft here, I don't think protected methods on an interface make much sense. Therefore I prefer option 2.
However, if this is too much work now, we can create a task to do that later and proceed with option 1 for now.

What do you think @q66?

YOhoho added a comment.EditedJun 19 2019, 2:20 AM

Note that current state is option 1. eolian_mono ignore @protected tags and make interface method public. Ah, you mean it is only interface case.
I also prefer option 2. end user shouldn't use @protected methods directly.