Re: Pointers to "why C behaves like that ?"

"Nick Maclaren" <nmm1@cus.cam.ac.uk>
24 Nov 2002 01:18:26 -0500

          From comp.compilers

Related articles
[14 earlier articles]
Re: Pointers to "why C behaves like that ?" peter_flass@yahoo.com (Peter Flass) (2002-11-20)
Re: Pointers to "why C behaves like that ?" peter_flass@yahoo.com (Peter Flass) (2002-11-20)
Re: Pointers to "why C behaves like that ?" er+cc@cs.brown.edu (Manos Renieris) (2002-11-20)
Re: Pointers to "why C behaves like that ?" md9slj@mdstud.chalmers.se (Stefan Ljungstrand) (2002-11-20)
Re: Pointers to "why C behaves like that ?" torbenm@diku.dk (Torben Ægidius Mogensen) (2002-11-24)
Re: Pointers to "why C behaves like that ?" torbenm@diku.dk (Torben Ægidius Mogensen) (2002-11-24)
Re: Pointers to "why C behaves like that ?" nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-11-24)
Re: Pointers to "why C behaves like that ?" thp@cs.ucr.edu (2002-11-24)
Re: Pointers to "why C behaves like that ?" jacob@jacob.remcomp.fr (jacob navia) (2002-11-24)
Re: Pointers to "why C behaves like that ?" nicola.musatti@objectway.it (Nicola Musatti) (2002-11-24)
Re: Pointers to "why C behaves like that ?" fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-11-24)
Re: Pointers to "why C behaves like that ?" anw@merlot.uucp (Dr A. N. Walker) (2002-11-24)
Re: Pointers to "why C behaves like that ?" whopkins@alpha2.csd.uwm.edu (Mark) (2002-11-24)
[46 later articles]
| List of all articles for this month |

From: "Nick Maclaren" <nmm1@cus.cam.ac.uk>
Newsgroups: comp.compilers
Date: 24 Nov 2002 01:18:26 -0500
Organization: University of Cambridge, England
References: 02-11-059 02-11-083 02-11-097 02-11-102
Keywords: C, design, types
Posted-Date: 24 Nov 2002 01:18:26 EST

Mark Alexander Wolton <mwotton@cse.unsw.edu.au> wrote:
>Robert A Duff wrote:
>> Declarations make programs easier to understand, presuming you are
>> declaring useful information (useful to the human reader).
>>
>> Somebody mentioned type inference in ML. My opinion is: it's nice
>> *within* a single function, but the *interfaces* to pieces of software
>> ought to have *explicit* declarations of types, so I can understand
>> them without reading all the code.
>
>I agree completely. In the process of development of a module, though,
>types can change dramatically, and type inference allows you to avoid
>the janitorial jobs. An interface should always be explicitly typed.


Yes, indeed.


However, it IS acceptable to declare that an argument is an abstract
type (i.e. by the specification of its properties) and accept any
type that meets the constraints. What isn't acceptable is for any
property of the type to be "sneaked across" the boundary.


This was a major problem in algebraic languages, because complicated
algorithms are often very sensitive to properties that they don't use
explicitly. It is also why many algorithms for real numbers do not
work in the complex domain, even if they don't explicitly use the
ordering properties. Axiom was the third generation, and the first
to get this aspect more-or-less correct.


It is ruddy hard to get this right in language design, and even
harder to check it in compilers :-(


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679


Post a followup to this message

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