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

Bugfix: Passing mutex by reference #28

Merged
merged 1 commit into from
Mar 7, 2021
Merged

Bugfix: Passing mutex by reference #28

merged 1 commit into from
Mar 7, 2021

Conversation

acook
Copy link
Owner

@acook acook commented Mar 7, 2021

Original:

The current version of Golang seems to support this without problem.

I've tested everything and it seems to work just fine.

I'm quite certain that it used to refuse to compile because it no longer
matched the interface.

I still suspect something is screwy because now some types pass by
reference and some pass by value.

I refreshed my memory on Go Interfaces and it seems like it pretty much comes down to if you define an interface function on a reference then that interface only applies to the pointer type. However if you define the function on a value then the interface applies to both reference and value types.

What I suspect happened previously is that there was some code that relied on the false assumption that Stacks could be values on another Stack and this was breaking things. That doesn't really make any sense and is why the value type cases were removed in this PR as well.

See also:

The current version of Golang seems to support this without problem.

I've tested everything and it seems to work just fine.

I'm quite certain that it used to refuse to compile because it no longer
matched the interface.

I still suspect something is screwy because now some types pass by
reference and some pass by value.
@acook
Copy link
Owner Author

acook commented Mar 7, 2021

mutex passing by value

@acook acook changed the title Pass mutex by reference Fix: Pass mutex by reference Mar 7, 2021
@acook acook changed the title Fix: Pass mutex by reference Bugfix: Passing mutex by reference Mar 7, 2021
@acook acook merged commit 937b71f into master Mar 7, 2021
@acook acook deleted the mutex_by_value branch March 7, 2021 20:06
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.

1 participant