| ▲ | wannabe44 2 hours ago | |||||||||||||||||||
Oh yeah totally agree. I don't understand why someone would want to write `slices.Contains(s, needle)` when you can write this beautiful poem like a Shakespeare in VSCode:
Oh and I totally want to build a stack trace manually. It's like doing cardio to me.
This is very elegant by the way, so that we need errors.Is now, which has to dynamically check if the error implements Unwrap() error or Unwrap() []error. Because having any language facilities for error handling is harmful. | ||||||||||||||||||||
| ▲ | b7e7d855b448 an hour ago | parent | next [-] | |||||||||||||||||||
I don't say it's perfect, but right in this moment I feel most comfortable with go and I don't mind jumping through a few hoops or writing things multiple times | ||||||||||||||||||||
| ▲ | msie 2 hours ago | parent | prev | next [-] | |||||||||||||||||||
You forgot to put /s after your post. | ||||||||||||||||||||
| ▲ | logicchains 2 hours ago | parent | prev [-] | |||||||||||||||||||
Your handwritten one has a major performance bug:
Do you see it? It copies the v into a local variable, which could be tremendously wasteful if it's a large struct. You should instead be taking a pointer to s[i] and comparing the value there with `needle`.If you'd used `slices.Contains(s, needle)`, on the other hand, it could have such a performance bug in it and you'd never know. | ||||||||||||||||||||
| ||||||||||||||||||||