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

Dynamic binding

I don't have time to be involved in this discussion in an ongoing fashion,
so I'm just going to do a small "core dump" of my position on the subject
in reply to Gyro's message (and in support of Andy's reply):

"Dynamic Binding" is not a problematic linguistic artifact which we
can dispense with by voting it out.  Rather, it is a problematic 
real-world artifact which cannot be eliminated by vote.

It is like the abstract of the "immovable object" and the "unstoppable"
force.  Both are useful to reason about in the abstract--in fact, so useful
that you would not want to a priori rule out the use of either even though
they don't do so well when combined.

The ability to write a program whose contract absolutely cannot be
overridden is useful.  The ability to write a program which can absolutely
always override another's contract is also useful.  The best we can do is
provide primitives which give people the ability to say which they intend.

The problems which lead to the use of dynamic binding are real.  They
aren't just caused by someone misunderstanding the potential ill effects
of dynamic binding.  If the issue were only "modules" or "lexical
scoping", then people would just use those because they're already
(effectively) in Scheme.  The problem isn't that we have a primitive
sitting around which no one uses, but rather that there's a certain
feature which whether we provide it or not, keeps coming up in
discussion. There must be something more than mass ignorance which
makes this happen.

I believe there are uses which involve a legitimate need to factor
dynamic, environmental information into a program.  As Andy suggests,
if you exclude this capability at the language level, you just force the
person to simulate it using the language.

The situation is analogous to the naming of the "funny little thing at
the end of a shoelace that keeps it from fraying".  I hear there's a
name for the thing, but the fact is that it's not in the standard
dialect which most people speak, and it doesn't matter because most
people can simulate its effect by just composing words in the given
language.  But if the word "home" had been omitted, that would be a bad
thing linguistically because although one could talk about "the funny
little wooden or brick (or cardboard) structure that you come home to
every night", it would not be fun to have book titles and punchy little
phrases like "there's no place like the funny little wooden or brick (or
cardboard) structure that you come home to every night".  Usage patterns
tell you what needs to be constructable, what needs to be present
primitively, and what doesn't need to be there at all.

As with the GOTO statement or an iteration facility, dynamic binding is
a thing about which people like to speak and reason. Language designers
may choose to support such speech at the languistic level or not, as
they choose, but that only affects how concepts are expressed verbally--it
does not dictate which concepts are permitted.

No language can optimize all things.  A primary goal of a language
should be to optimize those things which people often say.  Another 
is to make the common things efficient.  If you optimize for the wrong
set of commonly-used expressions, people will resent the fact that you have
made their speech patterns too clumsy or their code too slow, and they will
seek another language.

In the case of Dynamic Binding, it's tough to implement this correctly
or efficiently in user code (at least without DYNAMIC-WIND, and maybe
even then), so that's another argument for having it.

I'm not definitely of the opinion that dynamic bind should be in scheme.
But I'm definitely of the opinion that dynamic bind should definitely
not definitely not be in scheme. [Yes, I double-checked, there are no
spurious words in the previous sentence.]  That is, in Kripke's
terminology, it may be "true" that dynamic bind doesn't belong in
Scheme, but it is not "necessarily true" that it doesn't belong.  Any
decision to leave it out must be done on the basis of reasoned debate,
probably about statistical need, not on the basis of any claims of 
inherent truth.