[plt-scheme] Is it helpful to flag set!s to variables outside of a define form?

From: Grant Rettke (grettke at acm.org)
Date: Mon Apr 20 15:22:46 EDT 2009

It is sort of ironic, in the Java world, that most Java developers
seem to look down on the idea of "side-effect" free programming, ala
pure functional programming in Scheme for example. It is ironic for
two reasons:

1. Classes are a very convenient way to manage side effects and state.

2. Java tooling is tailored to help programmers manage the terrible
things that can happen due to confusion/misunderstanding about state
because it can be hard to manage in big multi-developer projects.

Here is an example, in the IDE that I use at work I have the following
syntax coloring configuration set up:

1. Everything is white by default.
2. String are yellow. Comments are green.
// here is the relevant part
3. Method local variables are light blue.
4. Method arguments are pink.
5. Class variables are *bold*
6. Static variables are italic.
7. Reassignments of parameters and local variables are highlighted
with an enclosing box.

This arrangement makes it very easy for programmers doing maintenance
coding, or new development, or code reviews, to pick up on bad "code
smells". In fact without it, it would be nearly impossible to
*quickly* get a sense for "what is happening".

Would it be interesting, in DrScheme, to have check-syntax flag set!s
that occur on variables defined outside of the 'define' form?

I suppose when functions are small, it is obvious. Perhaps this
problem doesn't occur in the Scheme world.


Posted on the users mailing list.