Hacker News new | ask | show | jobs
Show HN: I implemented Tilde – Operator for Go Compiler after months of research (medium.com)
6 points by Dentrax 1831 days ago
2 comments

Hey! This is my first attempt to learning of the contribution to Go Compiler. I just wanted to write a blog post about the journey.

Your feedbacks are valuable! Thanks!

If you do not use Medium, you can read the blog on the repository: https://github.com/Dentrax/go-tilde-operator/

Find the issue proposal: https://github.com/golang/go/issues/46847 Find the implementation PR: https://github.com/golang/go/pull/46848

I've used the tilde operator in Unity + C# quite a bit when mutating bitmasks that store state. For example, my player movement code manages its state within a bitmask. To remove a certain state, I do something like this to ensure the player exits a given state:

    if ((state.CurrentState & EPlayerState.Sliding) != 0)
    {
      state.NextState &= ~EPlayerState.Sliding;
    }
Outside of hobby game dev, I've never used it. From the PR, I'm not sure Go devs want it.