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

Joachim Durchholz <joachim_d@gmx.de>
11 Dec 2002 22:22:24 -0500

          From comp.compilers

Related articles
[61 earlier articles]
Re: Pointers to "why C behaves like that ?" fjh@students.cs.mu.OZ.AU (Fergus Henderson) (2002-12-03)
Re: Pointers to "why C behaves like that ?" nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-12-03)
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-12-03)
Re: Pointers to "why C behaves like that ?" vugluskr@unicorn.math.spbu.ru (Roman Shaposhnick) (2002-12-07)
Re: Pointers to "why C behaves like that ?" vugluskr@unicorn.math.spbu.ru (Roman Shaposhnick) (2002-12-07)
Re: Pointers to "why C behaves like that ?" lex@cc.gatech.edu (Lex Spoon) (2002-12-11)
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-12-11)
Re: Pointers to "why C behaves like that ?" marcov@toad.stack.nl (Marco van de Voort) (2002-12-11)
Re: Pointers to "why C behaves like that ?" marcov@toad.stack.nl (Marco van de Voort) (2002-12-11)
Re: Pointers to "why C behaves like that ?" lth@acm.org (Lars T Hansen) (2002-12-11)
Re: Pointers to "why C behaves like that ?" torbenm@diku.dk (2003-01-17)
Re: Pointers to "why C behaves like that ?" ralph@inputplus.co.uk (2003-03-17)
Re: Pointers to "why C behaves like that ?" skeeterdabeeterbunny@ameritech.net (skeeter da beeter bunny) (2003-03-22)
| List of all articles for this month |
From: Joachim Durchholz <joachim_d@gmx.de>
Newsgroups: comp.compilers
Date: 11 Dec 2002 22:22:24 -0500
Organization: Compilers Central
References: 02-11-095 02-11-128 02-11-150 02-11-177 02-12-021 02-12-051
Keywords: types
Posted-Date: 11 Dec 2002 22:22:24 EST

Roman Shaposhnick wrote:
>
> So what happens when all the signatures have the most general types in
> them ? My concern is -- how big the runtime hit will be.


If you leave the most general type in, the code will not be very efficient.
Example: if you have a function that's of type
      foo (Numeric): Numeric
then you'll probably have an inefficient foo() function.
However, if you call
      foo (5)
then the compiler can always generate a specialized, efficient variant
of foo (Integer).


I know that this doesn't work well with the standard division of labor
between compiler and linker. But you have similar problems even with
C++, so that's not a large factor in my eyes (YMMV).


> I still, can't believe that there won't be any, but that might be due
> to the lack of detailed information on Hindley-Milner typing.


Hindley-Milner typing is just a way of collecting type information. It
doesn't imply anything about the efficiency of the resulting program;
it's just a theory how far you can get without type information, if the
type system satisfies some basic properties (such as providing a common
supertype for any combination of types).


  > I will appreciate it if someone
> can give me any pointers to the basic papers on this topic.


Take a look at:
Michael I Schwartzbach: Polymorphic Type Inference.
It's available on the web (probably at Citeseer).


> P.S. And I still can't get a hold of the original Milner article,
> but I'll try the biggest library in the town today.


Original articles tend to bee disappointing; too much theory, little
practical value. (Which is OK, since seminal papers serve the purpose
of proving that the idea works; explanation and exploring the
practical consequences is what follows in the months and years after
the original article.) I found the Schwartzbach article very
readable.


Regards,
Joachim


Post a followup to this message

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