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

thp@cs.ucr.edu
24 Nov 2002 18:34:19 -0500

          From comp.compilers

Related articles
[24 earlier articles]
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)
Re: Pointers to "why C behaves like that ?" whopkins@alpha2.csd.uwm.edu (Mark) (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 ?" thp@cs.ucr.edu (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 ?" stephen@dino.dnsalias.com (Stephen J. Bevan) (2002-11-24)
Re: Pointers to "why C behaves like that ?" cgweav@aol.com (Clayton Weaver) (2002-11-24)
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-11-24)
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-11-24)
Re: Pointers to "why C behaves like that ?" jacob@jacob.remcomp.fr (jacob navia) (2002-11-26)
Re: Pointers to "why C behaves like that ?" jacob@jacob.remcomp.fr (jacob navia) (2002-11-26)
[36 later articles]
| List of all articles for this month |

From: thp@cs.ucr.edu
Newsgroups: comp.compilers
Date: 24 Nov 2002 18:34:19 -0500
Organization: University of California, Riverside
References: 02-11-059 02-11-087 02-11-089 02-11-130
Keywords: types, design
Posted-Date: 24 Nov 2002 18:34:19 EST

Nicola Musatti <nicola.musatti@objectway.it> wrote:
+ "Christian Bau" <christian.bau@freeserve.co.uk> wrote in message
+ [...]
+> So a language that allows you to drop declarations lets you save five
+> seconds because you don't have to type "long" or "int" or whatever in
+> two places, and then it costs you three hours to find the bug.
+>
+> It is much better if I can specify redundantly what the code is
+> supposed to do; that makes it more self-documenting and it is more
+> likely that the code doesn't compile if I make mistakes.
+
+ I think a distinction should be made between languages with static
+ typing and languages with dynamic typing.
+
+ For languages with static typing and implicit declarations I entirely
+ agree with your comment. On the other hand languages with dynamic typing
+ allow a degree of generic programming that seems to make a big
+ difference. Proponents of languages such as Python argue that static,
+ explicit typing requires from you a lot of effort in exchange for a
+ false sense of security: no program is correct just because it compiles
+ cleanly. The time you save can be devoted to increasing the extent and
+ coverage of your testing.


It may be possile to have our cake and eat it too -- most of it,
anyway. To accomodate generic programming, C++ must do a lot of type
inference, especially in the case of function templates, whose type
parameters are statically inferred from the types of the arguments.
And, it's clear that C++ could do a lot more type inferencing without
giving up any of its relatively strong static typing. Now consider a
Python compiler that behaves somewhat like a C++ as long as it can
statically infer types and that generates warnings and less efficient
code when it can't. A lanuage designed for static typing with dynamic
fallback could perhaps be useful both as a scripting language and as a
language for the development of multi-megaline software systems.


Tom Payne


Post a followup to this message

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