flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aalexandrov <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2809] [scala-api] Added UnitTypeInfo an...
Date Sat, 17 Oct 2015 10:18:52 GMT
Github user aalexandrov commented on the pull request:

    > Not all methods without paremeters should translate to methods without parenthesis...
    @StephanEwen I agree with that, but I cannot understand how the `UnitTypeInfo` might cause
a confusion here.
    The typeInformation macros are synthesized by the macro based on the inferred collection
type, which means that the meaning of `()` is resolved before that. Consider the following
    // in the Scala REPL
    case class Foo(answer: Int)
    // defined class Foo
    def f1(): Foo = Foo(42)
    // f1: ()Foo
    def f2: Foo = Foo(42)
    // f2: Foo
    val xs = Seq(f1(), f2) // how a literate person would write it
    // xs: Seq[Foo] = List(Foo(42), Foo(42))
    val xs = Seq(f1, f2) // how a dazed & confused person would write it, but still compiles
    // xs: Seq[Foo] = List(Foo(42), Foo(42))
    val xs = Seq(f1, f2()) // even worse, but this breaks with a compiler exception
    // error: Foo does not take parameters
    //       val xs = Seq(f1, f2())
    val xs = Seq((), ()) // typing '()' without syntactic context resolves to Unit
    // xs: Seq[Unit] = List((), ())
    In all of the above situations `env.fromCollection(xs)` is (1) either going to typecheck
and trigger `TypeInformation` synthesis or (2) fail with the above.
    Can you point to StackOverflow conversation or something similar where the issue you mention
is explained with an example?

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message