News for hackers. Stuff that matters.
Re:Pyret: A new programming language from the creators of Ra... by mercurial on Saturday November 09, 2013 @04:44PM (#6703397)
This might work better for pure functions. I can't imagine it working very well for complex, stateful code which requires mocking and resetting the state between tests.
Re:Pyret: A new programming language from the creators of Ra... by tel on Saturday November 09, 2013 @07:58PM (#6704485)
Given that Pyret is functional, there's a good chance there will be an emphasis on simple, pure functions.

Beyond that, I'd agree completely. Doctests, for instance, are quite terrible when you can't fit all of the logic into one line, but then I think it's usually a sign of a well-designed function when it's good a good enough interface to get a few pithy doctests in.

Re:Pyret: A new programming language from the creators of Ra... by skrishnamurthi on Sunday November 10, 2013 @08:23AM (#6706336)
Though Pyret is not pure, our emphasis is heavily on "functional first", even for objects. We believe state should be used carefully and for good reasons. HtDP (www.htdp.org) has two whole chapters on state at the end, giving design recipes for their use, and I'm revising some of these in PAPL (papl.cs.brown.edu/2013/).
Re:Pyret: A new programming language from the creators of Ra... by skrishnamurthi on Sunday November 10, 2013 @08:24AM (#6706338)
This is why a test block is a block. Writing inline tests for stateful functions in Racket was a bit painful because it is so heavily expression-oriented. We want to make this feel more natural.

(Another virtue of test blocks: you can write little local helper functions. There's an example of this on the Pyret home page.)

Re:Pyret: A new programming language from the creators of Ra... by acjohnson55 on Saturday November 09, 2013 @05:57PM (#6703905)
They didn't say one way or the other whether the language was pure FP, but I don't think any of the examples featured mutuality
Re:Pyret: A new programming language from the creators of Ra... by skrishnamurthi on Sunday November 10, 2013 @08:21AM (#6706330)
Pyret is not pure. We have mutation. But mutation has its own syntax different from regular binding. Variables (as opposed to identifiers) are preceded by "var", and variable mutation uses ":=". [Similarly for fields.] This it to make clear to all forms of readers -- programmers, compilers, IDEs -- when something is mutable.