You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "yyy1000 (via GitHub)" <gi...@apache.org> on 2023/01/28 03:59:18 UTC

[GitHub] [beam] yyy1000 commented on a diff in pull request #25203: Fix interface{} in iter& emit type of DoFn in Go

yyy1000 commented on code in PR #25203:
URL: https://github.com/apache/beam/pull/25203#discussion_r1089623120


##########
sdks/go/pkg/beam/core/funcx/output.go:
##########
@@ -84,6 +84,9 @@ func unfoldEmit(t reflect.Type) ([]reflect.Type, bool, error) {
 		if ok, err := isInParam(t.In(i)); !ok {
 			return nil, false, errors.Wrap(err, errIllegalParametersInEmit)
 		}
+		if t.In(i).Kind() == reflect.Interface || (t.In(i).Kind() == reflect.Pointer && t.In(i).Elem().Kind() == reflect.Interface) {

Review Comment:
   Thanks a lot! I'm clearer about this now.
   Does it mean we should not allow empty interfaces like "interface{}", but we do allow 'Universal Types'?
   But I still have a question is that, if a function has a param with "interface{}", like that
   ```
   Fn := func(interface{}){}
   t := reflect.TypeOf(Fn)
   ```
   but typex.ClassOf(t.In(0)) returns "Concrete", I ought to think it will return "Universal".
   The type system is a bit complex, I'm still learning it. :)
   



-- 
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