Re: Definable operators (Antoon Pardon)
4 May 1997 00:28:08 -0400

          From comp.compilers

Related articles
[23 earlier articles]
Re: Definable operators (1997-04-20)
Re: Definable operators (1997-04-20)
Re: Definable operators (David Rush) (1997-04-20)
Re: Definable operators (Craig Burley) (1997-04-22)
Re: Definable operators (Craig Burley) (1997-04-30)
Re: Definable operators (1997-04-30)
Re: Definable operators (1997-05-04)
Re: Definable operators (Dave Lloyd) (1997-05-04)
Re: Definable operators ephram@ear.Psych.Berkeley.EDU (Ephram Cohen) (1997-05-06)
Re: Definable operators (Francois-Rene Rideau) (1997-05-08)
Re: Definable operators monnier+/news/comp/ (Stefan Monnier) (1997-05-08)
Re: Definable operators (Craig Burley) (1997-05-08)
Re: Definable operators (Craig Burley) (1997-05-08)
[9 later articles]
| List of all articles for this month |

From: (Antoon Pardon)
Newsgroups: comp.compilers
Date: 4 May 1997 00:28:08 -0400
Organization: Brussels Free Universities (VUB/ULB), Belgium
References: 97-03-037 97-03-076 97-04-164
Keywords: syntax, design, comment

Craig Burley ( wrote:

: If you start thinking in terms of _maximizing_ the amount of semantic
: information in a small, localized expression typical of what you
: expect programmers to be doing in your language, you start doing a
: better job of (1). Maximizing semantic information means, to me,
: maximizing the number of relevant, even if smallish, things a person
: reading a work in the language can _know_ about the localized
: expression without having to worry about context. E.g. "a = b + c;"
: has greater useful semantic information in C than in C++, for reasons
: I've stated above.

: Whereas, the push for definable operators, overloaded operators,
: pass-by-reference, and so on is often driven by an overall process of
: _compressing out_, or _minimizing_, the amount of semantic information
: in a localized expression. It's _precisely_ the point that you
: _can't_ say nearly as much what "a = b + c;" means in C++ that makes
: C++ a better tool for so many programmers -- because they can redefine
: + to mean something very different from addition, to mean "change b
: and c", and so on. That's exactly what so many programmers ask for --
: maximum flexibility of expression -- which militates against the
: maximizing of semantic information that is so important in
: language-(1) design.

I understand what you are saying and even agree in large part.
Unfortunatly I don't see this happen in an enforcable way in the near
future. I think the push for overloadable operators makes sense. The
normal semantic information of "a = b + c" is not restricted to only
integers or floats. So it seems natural to allow the use of "+" if the
user introduces types to represent complex numbers, matrices etc. To
take a vary simple example if it makes sense to solve a number of
equasiations with Gauss-elimination and this algorith is the same
either for real or for complex numbers it doesn't make sense either to
force the programmer to rewrite the algorithm but now in the form of
"AddC(&a , b , c);" I would say forcing a programmer to write it like
this when it would very naturally expressed as "a = b + c;" is a loss
of semantic information too.

Is it the responsibility of the language to enforce "+" is only used
in appropiate ways or for that matter "insert"?

My first instinct is to say no. People should be taught the proper use
of a tool. It is not the responsibility of a tool to enforce the user
its good use. You might be able to change a chisel so it is impossible
to turn a screw with it. But I fear it would be less useful as a
chisel too.

But then I hear about what people are doing with the overloadable
operators in C++ and I think maybe we shouldn't start with giving
students full C++. Just as it makes sense to give students limited
tools that are less useful but are also less easy to abuse it may
make sense to give students limited languages to begin with.

I don't know, the last about this is definetly not said yet.
Antoon Pardon Brussels Free University Computing Centre
[I believe you've identified the nub of the question -- can the lanauge
or compiler force or at least encourage programmers to write readable
programs. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.