damccorm commented on code in PR #17429: URL: https://github.com/apache/beam/pull/17429#discussion_r863830842
########## sdks/go/cmd/specialize/main.go: ########## @@ -238,3 +246,130 @@ func upto(i int) []int { } return ret } + +func add(i int, j int) int { + return i + j +} + +func mult(i int, j int) int { + return i * j +} + +func dict(values ...interface{}) map[string]interface{} { + dict := make(map[string]interface{}, len(values)/2) + if len(values)%2 != 0 { + panic("Invalid dictionary call") + } + for i := 0; i < len(values); i += 2 { + dict[values[i].(string)] = values[i+1] + } + + return dict +} + +func list(values ...string) []string { + return values +} + +func genericTypingRepresentation(in int, out int, includeType bool) string { + seenElements := false + typing := "" + if in > 0 { + typing += fmt.Sprintf("[I%v", 0) + for i := 1; i < in; i++ { + typing += fmt.Sprintf(", I%v", i) + } + seenElements = true + } + if out > 0 { + i := 0 + if !seenElements { + typing += fmt.Sprintf("[R%v", 0) + i++ + } + for i < out { + typing += fmt.Sprintf(", R%v", i) + i++ + } + seenElements = true + } + + if seenElements { + if includeType { + typing += " any" + } + typing += "]" + } + + return typing +} + +func possibleBundleLifecycleParameterCombos(numInInterface interface{}, processElementInInterface interface{}) [][]string { + numIn := numInInterface.(int) + processElementIn := processElementInInterface.(int) + ordered_known_parameter_options := []string{"context.Context", "typex.PaneInfo", "[]typex.Window", "typex.EventTime", "typex.BundleFinalization"} + // Because of how Bundle lifecycle functions are invoked, all known parameters must preced unknown options and be in order. Review Comment: I think we're both wrong and its precede haha -- 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-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org