[racket] syntax, differently

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Jul 31 11:19:27 EDT 2010

On Sat, Jul 31, 2010 at 10:00 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
> Shriram's proposal and a private conversation with Mike suggested the following feature requests for the drracket teaching languages:
> 1. Could drracket limit the width of programs in the teaching language world to 80 columns?

This one seems doable (I'd probably make the text turn red when it
passes the 80th column or somethign instead of rejecting keystrokes).

> 2. Could drracket reindent all every time a programmer hits {return | run | submission server request }?

I'd be worried about this that some edits one does (maybe opening a
string?) would cause strange things to happen to the editor based on
intermediate states of the program. For example, if I have a string
that has multiple lines in it and then, before that somewhere I decide
to add a new string. This means that the stuff below that used to be
inside a string is now outside the string so it will now (temporarily)
be subject to the indentation rules. Then, when you finish the earlier
string, you now find that the original string's contents are messed

And this probably happens in other places in the grammar too. One
route would be to change the language so that strings (and other
problematic things) don't have the same open and closing delimiter.

We could also try going with a coloring-type thing where drracket
knows what the indentation should be and highlights lines that do not
follow the conventions. There would have to be some intuitive/obvious
way to say "fix up the reds now, please", (better than the current
"indent all" that no one seems to be able to find) to go along with
that, tho.

Also, there are probably performance implications here. Overall, this
one seems difficult. Maybe we could overcome the performance
implications with syntax errors instead of online red highlighting and
the syntax error message could include a "reindent all" button.

> These two alone would help ensure that programs look better than what we currently see. The reindent all would also immediately suggest to students missing parens etc. It would disallow the behavior where students spend time inserting N spaces at the beginning of the line.

(As far as time goes, I have none for at least 2 weeks (and in reality
maybe a month or more), so if someone else wants to try this first,
that'd be good.)


Posted on the users mailing list.