I used MIT-Scheme for an assignment recently(writing a simple ML interpreter), and decided to write up my comments on the language(Scheme, not ML). While I have used Scheme before, I have not used MIT-Scheme, so I was curious how different it would be from the other Scheme varieties I had used.
For the most part, there weren’t too many differences. MIT-Scheme was missing some functions that were in the R6RS specification, but it also had some additions. The parse-buffers were very nice, at least until I found out that the version on our school computers did not come with them.
One issue I had was that by default, MIT-Scheme evaluates arguments from right to left. While this does not matter in most cases, there are a few times where I needed the order to matter - for example, when dealing with a token stream. To parse tokens, I created a function that would return the next token each time it was called, and so I had several bugs due to let-expressions not binding variables to the correct value.
I had a few problems with IO in MIT-Scheme. I spent a few hours debugging read-string, until I realized that the problem was that the function did NOT consume the ending character. That means that it worked the first time it was called, but the next time it would just return the empty string - because the first character was the semicolon that it just ended on! This seems very counter intuitive to me. I also wish their was a better was to suppress the output of the interpreter - I had to redirect the interaction-i/o-port to a file so that the values of evaluated expressions were not displayed.
I also did not manage to get the exception handler to work properly. I wanted to install my own handler to catch every error - invalid calls to
car, cdr, etc - and just restart the interpreter, instead of the scheme interpreter having an error and prompting for restarts. No matter how I installed the error handler, this type of error would still prompt for restarts.
Tags: scheme