Hi, I would like to create a non-pointer constraint for a generic function. For example: ``` func F[T NonPtr](p T) { // do something with p } ``` Such that ``` F(MyStruct{}) // allowed F(&MyStruct{}) // disallowed, compile time ``` I'm aiming to ensure, in compile-time, that a generic function, which is intended to work with values only, cannot be misused by passing in a pointer. (I can provide more context on my use case if needed.) While this could be enforced with a custom linter, I feel this should be a built-in capability of the language. From what I understand, though, this feature isn’t currently supported.
What do you think? Thanks! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/f6d35aa1-01d5-40ee-a9ed-9f23aab9f9e1n%40googlegroups.com.