Derek M Jones wrote:
Frank,
Not all code is read equally.  If it works, nobody has
to bother comprehending it; if it doesn't work, it tends

It doesn't matter how often code is read, or even if it is
ever read once written.  The subjects have to think about
operators when they are writing it, so this is the connection
to occurrences in source code.

As I suggested in my previous message, if you look at how
often, and in what way, expressions have been changed in that
source code, you might find evidence to point towards which
operators are well-understood and which ones aren't.
As this is from well-known, experienced programmers writing
well-used, large scale programs under real-world conditions,
might this not be more useful evidence for you than small-scale
tests of other people that you then mix with aggregate data
derived from those large programs?

Now what about code that does
get read, do we assume a uniform distribution, or is the complicated stuff read more often?

Well, the complicated stuff is certainly read more closely than
the simple stuff, since, by definition, it's more complicated.

It probably doesn't matter,
we are only interested in the relative amount that gets read/written.
> We only need to assume a uniform distribution in the set of operators
> that are read.

> Ok, there is the possibility that code containing some operators will
> get read more often than code containing other operators.  For
> the time being I am happy to assume the consequences of this are
> small.

Do your assumptions about uniformity extend to the beliefs
of programmers too?  If not, how can you be sure any
results you gather are generalizable?

> The language assumption I make is that relative occurrence of
> operators is the same across languages.

Why are you assuming something you can measure?

All the binary operators common to these languages share the
same precedence.

Depends what you mean by "common to"; for example, '+' works
rather differently in perl, Javascript and C.

What the operators actually do is irrelevant.  When the expression
a + b * c is encountered the reader has to figure out which
operator apply to which operators (the subject of this experiment),
then they can worry about what the operators actually do.

I believe you're confusing how a compiler parses this expression
with how a person thinks about it.

In my experience, programmers only think that way about expressions
in classrooms and on tests.  '*' isn't "the operator, whose
function I don't know yet, but that has a higher precedence than '+'".
In the context of C, I would expect the above expression to be
read as "a plus b times c", with 'plus' and 'times' inextricably bound
in the mind to what they *mean*.  Precedence follows as a side-effect
of that, rather than being the dominant factor in reasoning about
the expression.

That's why I stress that cross-language problems have to be
controlled for, because when I'm programming in PHP or ruby or
Lisp or Java or some other language, how I think about that
language's operators and expressions is bound up with their
semantics.  This gubbins sticks to my thinking when I switch
languages, and is more likely to happen, the closer the languages
are conceptually and syntactically.  I doubt that I'm alone
in my linguistic befuddlement, since I see evidence of in
in other programmers too.  (I think that it's more likely
to be found in programmers with broader experience, so
programmers who've spent their entire careers programming
in one language might not know what I'm on about.)

Note, for the avoidance of doubt, that I do not separate
'operators' in some language and 'precedence rules for operators'
in that language.  So when I talk about understanding operators,
I'm implicitly talking about their precedence rules too.

It seems to me, from what you've written, that you not only
think that precedence rules are eminently separable from
operators, but that, in fact, programmers routinely think
about them in this entirely separate way; as if syntax trees
are uppermost in their minds when thinking about the software
they want to write.  I believe this is as unlikely as journalists
having Chomskian deep structure in mind when they are writing copy.
--
Frank Wales [EMAIL PROTECTED]

----------------------------------------------------------------------
PPIG Discuss List (discuss@ppig.org)
Discuss admin: http://limitlessmail.net/mailman/listinfo/discuss
Announce admin: http://limitlessmail.net/mailman/listinfo/announce
PPIG Discuss archive: http://www.mail-archive.com/discuss%40ppig.org/

Reply via email to