assignment expression peeve

Carl Banks imbosol at aerojockey.invalid
Fri Oct 17 18:17:15 EDT 2003


Donn Cave wrote:
> In article <6ZWjb.49$Vf7.34 at nwrdny02.gnilink.net>,
> Carl Banks <imbosol at aerojockey.invalid> wrote:
> ...
>> My contention is that a large part of what makes something "readable"
>> in code is that is it resembles, to some degree, natural language.
>> This is because we can use the parts of our brain that parse natural
>> language to help us parse code.  Makes sense, pretty obvious.
>> 
>> The thing is, these analogues have to match syntactically as well as
>> semantically.  In other words, if the language construct in question
>> does not have an analogue that matches syntactically, then we have to
>> acquire the ability to parse it.  Furthermore, if it turns out that
>> our "language circuits" are not able to internalize an unusual syntax,
>> then parsing it will always require intellectual effort.  (Whether
>> this is true of assignment expression I won't speculate at this
>> moment.)  In the end, we have something that is at least harder to
>> learn, and possibly takes more effort to read.
> 
> This part is less obvious.  Syntactical relationships are learned,
> and arguably learned in a very context sensitive way.

Well, I can assure you that it's at least harder to learn, seeing that
learning a new syntax is always harder than using syntax similar to
what you already know.  (Otherwise, explain why Spanish is easier to
learn for English speakers than Japanese.)

As for the argument that it could take more effort, let's just
remember that our internal language circuits cannot handle arbitrary
syntax.  Simple as assignment expressions are, I'm not so sure our
language circuits can parse a syntax which doesn't exist in any
language I know of (and I suspect doesn't exist in any language).  If
we cannot parse an assignment expression though ordinary language
processing, then it follows that it takes more effort to read it.

(I sense we're getting dangerously close to introducing Chomsky into
this discussion; if so, I'm outta here.)


> Computer
> programming languages are relatively simple and regular, and it
> is not clear that they depend a lot on congruence with some natural
> language.

I highly disagree with this statement, however.  

Relatively simple and regular has nothing to do with it.  Assembly
language is relatively simple and regular.  Intercal is relatively
simple and regular.  Perl is relatively simple and regular.  And
they're all unreadable messes.  (Even still, all of them rely on a
smittering of resemblance to natural language.)

There's a reason hardly any successful programming languages eschew a
resemblance to human language: because humans are good at thinking in
terms of language.


>> I hope I don't have to argue the point that most people think of
>> programming as imperative.  I believe programmers think of "a=b" as
>> "Set a to b," not "a's value becomes b's value".  Therefore, I don't
>> consider a declarative clause to be an analogue of an assignment; it
>> is both syntactically and semantically different.
> 
> If we stipulate that we are talking about Python programmers, maybe.
> 
> In more general terms, though, I think it could be argued that
> assignment actually doesn't play much of a role in natural speech
> anyway, whether in the declarative or imperative sense.

You're completely missing the point.

I'm not trying to claim that assignment, per se, plays a role in
natural speech.  My claim is that assignment is a command.  When a
programmer writes a=b, he's commanding the computer to set a to b.
Commands do play a role in natural speech, and only the imperative
mood conveys it (without descriptive circumlocations).

Which is (getting back to the point) why I think Martelli's example
was incorrect.


[snip]
> Basically, I don't think you want to tie the quality of a computer
> programming language to its congruence with English syntactical
> forms.  If there were a clear case for that, I think the FPL crowd
> would come out way ahead.

Basically, I think you're missing the whole point of what I'm saying,
and are therefore ill suited to judge the strength of my position.


-- 
CARL BANKS                   http://www.aerojockey.com/software

As the newest Lady Turnpot descended into the kitchen wrapped only in
her celery-green dressing gown, her creamy bosom rising and falling
like a temperamental souffle, her tart mouth pursed in distaste, the
sous-chef whispered to the scullery boy, "I don't know what to make of
her." 
          --Laurel Fortuner, Montendre, France 
            1992 Bulwer-Lytton Fiction Contest Winner




More information about the Python-list mailing list