[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Mutable Pairs

On 06/16/10 01:44, Brian Harvey wrote:
>> I still think that
>> they help Scheme programmers to write more robust code
> I think that, like most teachers and many parents, you choose not to notice
> the difference between "help" and arm-twisting.  Basically your argument is
> the same as the one that forbids teenagers power tools (or sometimes even
> Swiss Army knives).  The two differences are (1) you don't /quite/ want to
> forbid them, just surround them with a lot of off-putting bureaucracy and
> shaming, like the welfare office, and (2) we're talking about adults, not kids.

Ah-hah! My speciality, a STRETCHED METAPHOR DEBATE! *cracks knuckles* ;-)

I'm a parent *and* a cub scout leader (which is almost a teacher...) and
my approach to this is quite simple: I eagerly introduce my (four year
old) daughter to power tools, although I won't let her use any more than
the simplest herself for now; and when she's older then, like my cubs,
I'll encourage her to use them.

HOWEVER, like with mutable cons cells, I teach:

1) Only use the power tool for what it's designed for (use mutable cons
cells for actual changing data structures, not for making lists we might
wish to reason about as if they are immutable)
2) Take appropriate safety precautions (think really carefully about who
else might have a reference to the cell you're mutating)
3) The power tools live in a special cupboard, and aren't left lying
around where you might be tempted to reach for them rather than a more
appropriate tool (make immutable cons cells your default choice, and
break out the mutables when you really need them)


Alaric Snell-Pym

Scheme-reports mailing list