You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/17 21:02:01 UTC

[GitHub] [beam] gonzojive commented on issue #21929: [Feature Request]: GoSDK: Generics API for beam

gonzojive commented on issue #21929:
URL: https://github.com/apache/beam/issues/21929#issuecomment-1159224235

   Thanks for sharing your thinking.
   
   One issue I punted on is the usage of `any` in `T any` below:
   
   ```go
   func Create[T any](scope beam.Scope, obj ...T) Collection[T] {
   	asInterfaces := lo.Map(obj, func(elem T, _ int) any { return elem })
   	untyped := beam.Create(scope, asInterfaces...)
   	return Collection[T]{untyped}
   }
   ```
   
   It seems like the signature should be more like this to ensure things that can be encoded are being passed around:
   
   ```go
   func Create[T Serializable](scope beam.Scope, obj ...T) Collection[T] { /* ... */ }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org