Thursday, February 16, 2012

Some Initial Thoughts on R7RS

By now, I'm sure you've heard the huge news: public review has started for the R7RS small language. Exciting, right?!

I've been through the draft and here are some initial thoughts. I'm going to let them all gel a bit before I decide if I want to bother the steering committee with any of the feedback.

In no particular order...

  • Overall, the draft looks good. They've managed to reclaim most of the tiny-language feel that was lost in R6RS. Kudos to the steering committee for an excellent job.
  • (p8) I'm not really sold on adding new comment options #; and #|...|#, but that's probably more a reflection of my love of comments. Certainly #; is clever, and I suppose #|...|# may be handy for literate programming, but still, I'm not there yet.
  • (p8) Same goes with the directive #!fold-case and !#no-fold-case. Perhaps if the language offered a new way to add directives, I'd embrace them further. But for now, they just seem like special cases that may be handled in other ways. For example, perhaps case folding could be accomplished with a parameter?
  • (p9) I see there's still no way to add a new disjointed type to the system. I suppose this can be approximated using other means. Still, I wonder if it creating new types could be a useful foundational element.
  • (p18) I was pleased to see make-parameter was added to the standards. Parameters provide a really useful middle ground between passing local state around and global variables. I'm convinced it's a pattern other languages like Java and PHP may one day discover.
  • (p21) I was disappointed to see that syntax-case didn't make the cut. Seems to me that syntax-case is the next logical evolution of macros, just like syntax-rules was the logical choice over defmacro. syntax-case allows you to create any sort of macro you can imagine and do it in a relatively clean way. I know it's probably considered too big for the small language. In my super-compact-language dream, I'd see leaving out define-library and the details behind exception handling, and use syntax-case and make-parameter to implement these. That's probably pushing things too far, and losing out on some key foundational elements that will make R7RS large layer nicely on the small language. Still, a Schemer can dream.
  • (p25) I'm not really sold on including define-record-type in the small language definition. Seems like it could be moved to the large language spec with minimal impact. As proof, the example programs in the back of the report demonstrate quite well that you can write code without records.
  • (p26) As stated above, part of me feels like define-library could be pushed off to the larger spec. Libraries are used to structure code, and closures already do that quite well. But, as a practical matter, a library syntax probably serves as glue to hold the scheme community together. If we're going to have a module system in the R7RS spec, I suppose I like the one that's being offered up here.
  • (p46) I'm pleased to see byte vectors are available.
  • (p50) I feel more or less the same way about the exception framework presented as I do about define-library. The purist in me wonders if we could get away with parameters and continuations, and not bother defining a handful of error handling functions. But, the realist in me knows that having a sane exception framework will make software development much less painful. Feh.
  • (p71) The notes section and example sections are quite helpful, and truly make this a language spec one can sit down and read.

Again, I've got to say I'm really impressed with what the steering committee came up with. R6RS left quite a bitter taste in everyone's mouths, and they've done an excellent job of picking up the pieces.


  1. The only aspect of r6rs that left a bad taste in my opinion was the vitriolic reaction to it. Sadly, it seems that the r7rs sees itself as being part of that reaction.

  2. Ben:

    > #;

    It is a great feature; you can so easily comment out one expression among many.

  3. Sam:

    R6RS may at least be valued as a catalyst for the community. That is better than stagnation.

  4. Grant - I agree with your comment to Sam. I love the message that you can over-reach, and yet the result isn't catastrophic.

    As I continue to wrestle with R7RS points above, I'm seeing more and more, what the steering committee has put together is really quite solid. I'm not sure they arrive there as easily without all the lessons from R6RS.

    As for #; - it's probably one of those things that grows on you. Like, say, using [] to break up the monotony of (). At first this seems absurd, but once you get used to it, you can't imagine how you lived without them.

  5. This comment has been removed by a blog administrator.

  6. A bit late now, but:

    Case-folding of source can't be done with a parameter, because parameterization executes at run time, whereas reading source happens at compile time, or even before compile time.

    Define-record-type is about disjoint (hopefully not disjointed) types.

    We didn't want to have any low-level macro system, because it would complicate the module system. With just syntax-rules, we don't have to worry about phasing issues.



Related Posts with Thumbnails