Skip to content

Migrate back to generic type parameter #336

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

Closed
wants to merge 1 commit into from
Closed

Conversation

bjacotg
Copy link
Collaborator

@bjacotg bjacotg commented Dec 8, 2023

Do not merge.

Attempt at fixing #323

@hovinen
Copy link
Collaborator

hovinen commented Dec 8, 2023

Oh dear, don't I feel sheepish. Seems I'll have to update the blog post.

I'd really like to understand why it works now and not before. Perhaps because we then incorporated the and() and or() methods into Matcher itself rather than using an extension trait?

More importantly, will we end up shooting ourselves in the foot again with this change? We should make sure we understand its implications really well before deciding to merge.

@bjacotg
Copy link
Collaborator Author

bjacotg commented Dec 8, 2023

Yep, I agree. I started playing with this option considering it will be a trade-offs between Matcher::and(...) and fixing #323 and maybe getting a better understanding of the issue. But everything seems to work so I kept playing.

After a quick test with the proto library, it does work, so seems promising! But, I won't submit this anytime soon. I will have to write a nice looking doc and deep dive a little further.

For the explanation of why things did not work at the time, the move away from the extension trait looks like a good candidate. I will investigate further.

@bjacotg
Copy link
Collaborator Author

bjacotg commented Dec 8, 2023

Just came back from time travelling. Moving from the trait extension to the Matcher trait did not solve the issue. However, using PhantomData to force ActualT as a paramter of StrMatcher does solve the issue. See this PR.

So, using associated type does not solve the issue by itself, but it forces the StrMatcher to use PhantomData, which solves the issue. I think.

It's too late for me to draw any conclusion to all of this. I will get back to it next week.

@bjacotg
Copy link
Collaborator Author

bjacotg commented Jan 12, 2024

Closing this PR.

@bjacotg bjacotg closed this Jan 12, 2024
@bjacotg bjacotg deleted the generic_parameter branch January 12, 2024 13:24
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.

2 participants