Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use template where clause to avoid a runtime type test. #14

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Use template where clause to avoid a runtime type test. #14

wants to merge 30 commits into from

Conversation

jackpal
Copy link

@jackpal jackpal commented Aug 1, 2020

Hi Thomas,

Here's what I meant by my tweet saying that I didn't think you needed the runtime type check. The "where" clause turns it into a compile-time type check.

I wasn't able to test this. It builds, but it doesn't look like there's any code in the current project that uses the code that changed, so I don't know if it works or not.

It seems to me that it should work, though. And the assert will at least provide runtime evidence if it's incorrect.

Copy link
Contributor

@ericlewis ericlewis left a comment

Choose a reason for hiding this comment

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

Hooray generics!

@Dimillian
Copy link
Owner

Dimillian commented Jan 2, 2021

If you login and click on your profile it'll load a GenericListContent because it need to displays posts and comments in the same list. With your PR it's not working anymore. It seems like the first initialiser with the where constraints is never called.

So it goes in the generic initializer and fail to decode the list.

Maybe something else is missing?

Copy link
Contributor

@ericlewis ericlewis left a comment

Choose a reason for hiding this comment

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

Doesn't work

@jackpal
Copy link
Author

jackpal commented Jan 3, 2021

If you login and click on your profile it'll load a GenericListContent because it need to displays posts and comments in the same list. With your PR it's not working anymore. It seems like the first initialiser with the where constraints is never called.

So it goes in the generic initializer and fail to decode the list.

Maybe something else is missing?

Are you sure my PR is causing the issue you are seeing? I just forked and built https://github.com/Dimillian/RedditOS on Xcoder 12.3 / MacOS 11.2 beta without my pull request, and when I sign in and click on a profile page, I get this infinite spinner:

Screen Shot 2021-01-02 at 10 19 50 PM

_

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.

6 participants