1. 4

  2. 8

    This is really just runtime assertions, it’s not type checking in any sense anyone familiar with type systems would use.

    • Type info itself is object, you can check it and even change it during run time.

    • Checking type run every time method call… it might be overhead, but it’s not big deal.

    • There is no static analysis.
    1. 5

      Yep. For reference, I believe the term “gradual typing” is derived from this paper, and there the authors specifically distinguish between runtime constructs vs static constructs. Words mean things, etc etc.

      1. 7
                                     user     system      total        real
        RubypeCommonClass        0.530000   0.010000   0.540000 (  0.566493)
        CommonClass              0.030000   0.000000   0.030000 (  0.035718)
                                     user     system      total        real
        RubypeDucktypeClass      0.590000   0.010000   0.600000 (  0.682504)
        DucktypeClass            0.030000   0.000000   0.030000 (  0.029856)


        1. 2

          I’m not sure what you are responding to here. I’m not concerned with the performance, I’m concerned that this doesn’t actually do typing.

          1. 6

            I was just elaborating on the theme of “it does not do what they say.” A twentyfold decrease in performance does not sound like “it’s not big deal.”

            1. 2

              Ah, good point. Thank you.

          2. 2

            Out of curiosity, since this seems to be getting downvoted rather badly: why are you flagging this as “incorrect?” These are the benchmarks presented on the linked Github page.

          3. 3

            I have filed a GitHub Issue suggesting that Rubype change its terminology: Don’t say Rubype offers “gradual type checking”.

          4. 7

            As @apy mentioned, this isn’t really type checking. It’s contracts. With that in mind, how is this gem different than the existing contracts gem?

            1. 2

              The author of Rubype wrote the following in response to the author of contracts.ruby:

              While I’m appreciate your awesome gem and I know your point(I don’t wanna reinvent the wheel too), I think philosophy are slightly different between contracts.ruby and Rubype.

              I’m totally OK with sharing knowledge or thought but I can’t help contracts.ruby(I’m so sorry about that) After watching video you posted on vimeo and using it, I found that contracts.ruby works so well, and has much useful functions. But I wanna make function simpler and basis for Ruby3.0.

              1. 2

                Thanks for finding that! Unfortunately I feel like gogotanaka doesn’t really answer the question. He wants his library to be simple, but doesn’t say what about contracts.ruby isn’t simple. I’ll bet that fixing the bugs egonSchiele mentions will make Rubype more complex.

            2. 3

              Gradual type checking smells like unit testing did circa 2005: mainstream interest without the drive to actually follow through.

              “It’s too hard, and we don’t have enough time,” they say, letting themselves off the hook again.

              1. 3

                Gradual typing is being added at the language level of basically every major dynamic language. We’ll see if the users of said languages use those features, but I imagine they will.