Skip to content

Conversation

@mkhubaibumer
Copy link

@mkhubaibumer mkhubaibumer commented Feb 23, 2024

rendered

This PR proposes RFC for the following feature:

  • Template typename passing with inheritance

This PR proposes RFCs for the following two features:

- Localized Layout Options
- Template typename passing with inheritance

Signed-off-by: mkhubaibumer <[email protected]>
Signed-off-by: mkhubaibumer <[email protected]>
Signed-off-by: mkhubaibumer <[email protected]>
Signed-off-by: mkhubaibumer <[email protected]>
@mkhubaibumer
Copy link
Author

@cmnrd @lhstrh @petervdonovan @edwardalee for review and suggestions

Copy link
Contributor

@cmnrd cmnrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the stated problem. I am not fully sure if LF should be focused on fixing this, though. If we do so, we are risking becoming yet another C++. Given the code generation we do, we would certainly be in the position to bring higher-level language concepts to C, but I wonder if that should be our focus. After all, we have targets that already provide the necessary tools as built-in features.

@petervdonovan You probably understand best the current implementation of C generics. Could you comment on the feasibility and how much effort it would be to implement this?

@cmnrd cmnrd requested a review from petervdonovan February 23, 2024 15:16
@petervdonovan
Copy link
Contributor

I believe that this might take as little as an afternoon to implement and that in any case it would not be a four-month project.

I am not fully sure if LF should be focused on fixing this, though. If we do so, we are risking becoming yet another C++. Given the code generation we do, we would certainly be in the position to bring higher-level language concepts to C, but I wonder if that should be our focus. After all, we have targets that already provide the necessary tools as built-in features.

But I also share this concern. I also had this concern back when generics were being implemented; this is why I chose not to add tests to show that inheritance was compatible with generics.

If I understand the history (I was not around at the time when this happened), inheritance was introduced experimentally early on in the project when it was easier to introduce features quickly without much discussion. Over time there has been resistance to removing it because it was already there. And now because it is called "inheritance" and in the Java/C++ world, inheritance is often the go-to solution for code reuse, this mechanism might end up being used a lot, even if there are other ways to achieve code reuse.

I think that in order to resolve this, either inheritance should be deprecated, or people like me who have concerns about inheritance should stop arguing about it and just commit to getting inheritance to work properly and writing proper tests for it. I don't know which of these two paths is more pragmatic; maybe choosing one of them should be the subject of another RFC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants