1. 25
  1.  

  2. 5

    Hi, Pyret developer here (I hack on error messages)! If anyone has any questions, I’ll do my best to answer or grab someone who can!

    1. 4

      A couple questions, about the check and where blocks:

      1. Do you know if they’re consciously inspired by the Design by Contract ideas from Eiffel (and other languages)?
      2. The front page says “These assertions are checked dynamically” – are those conditions checked at compile time, first execution of each function, only during a separate testing run, or what?
      1. 2

        check, where and examples blocks all exist to support the ‘examples’ and ‘testing’ phases of How to Design Program’s functional design recipe. The placeholder expression syntax (...) and doc blocks are other features that Pyret has to encourage the design recipe.

        Testing statements are executed in the order they appear in the program alongside other top-level expressions. If you run:

        print(1)
        
        check:
          print(2)
        end
        
        print(3)
        

        The result is that 1, 2, and 3 are printed (in that order).

        1. 1

          Interesting. For the where expressions on function definition: are those executed when the function definition is first encountered, or when the function itself is first executed?

          1. 2

            At the point when the definitions are “encountered” is a good way to think about it. So, the former.

    2. 1

      Interesting how a language that so many seem to either loathe, love, or find utterly boring keeps inspiring new tools and paradigms all the time.

      Must be something to it, despite all the naysayers.

      1. 1

        Which one?