Related articles |
---|
Re: Possible to write compiler to Java VM? ncohen@watson.ibm.com (1996-01-29) |
Safety and power in languages truesoft!sw@uunet.uu.net (1996-02-02) |
Re: Safety and power in languages bobduff@world.std.com (1996-02-04) |
Re: Safety and power in languages salomon@silver.cs.umanitoba.ca (1996-02-09) |
Re: Safety and power in languages truesoft!sw@uunet.uu.net (1996-02-09) |
Re: Safety and power in languages mfeldman@seas.gwu.edu (1996-02-12) |
Re: Safety and power in languages fabre@gr.osf.org (Christian Fabre) (1996-02-13) |
Re: Safety and power in languages eachus@spectre.mitre.org (1996-02-13) |
Re: Safety and power in languages darius@phidani.be (Darius Blasband) (1996-02-13) |
Re: Safety and power in languages Roger@natron.demon.co.uk (Roger Barnett) (1996-02-14) |
From: | truesoft!sw@uunet.uu.net (Steve Witham) |
Newsgroups: | comp.compilers,comp.lang.ada |
Date: | 9 Feb 1996 17:18:02 -0500 |
Organization: | SMDS Inc. |
References: | 96-01-116 96-02-057 |
Keywords: | design, Ada |
Here we're having an argument about whether safety is really worth it.
The answer is, putting in safety features that have a big payoff but
don't get in the way or weigh too much, is an art. I wouldn't try to
defend Ada, for instance. On the other hand I think some people go
overboard in defending the need of programmers to do hairy things for
the sake of efficiency or just to keep their creativity unfettered on
principle, or because "I know what I'm doing."
Anyway it looks like Daniel Salomon knows something of the Art of
Safety, so we mostly agree and I'll just use this opportunity for
random snipes.
Daniel J. Salomon <salomon@silver.cs.umanitoba.ca> wrote:
>Let me give two concrete examples of what I am talking about.
>
>.....In many algorithms the type of a union
>variable can be known from the context in which it is used...
But in many situations you're not programming an algorithm but
maintaining a hairy, sprawling mass of Other People's Code. Who
knows, looking at this function, what some other function might have
put in this union? Also, being forced to record the type doesn't
prevent you from using your algorithm, right? It just adds extra
lines.
>Another example is...
>
> # define MAX(x,y) ((x)>(y)?(x):(y))
Oh! You mean as in,
m = MAX( a[i++], b[j++] );
or,
m = MAX( i--, 0 );
or
c = MAX( getch(), 128 );
? :-)
"Everybody knows" the danger there, but...have you never made that
mistake? (Your having designed "Safer_C" without macros shows that
maybe you have!)
>[Current safe languages ways of doing this sort of thing] can usually take
>more skill to use, more source code, and more effort to compile, and may
>not provide the full polymorphism of the C macro.
Like I said, I won't defend Ada. But in Smalltalk, I think, you could
just add a max method to the most generic number class and all types
of numbers would inherit it, right? Sure seems reasonable to me.
My point was about safety itself more than dumb implementations of it.
Like I said in my earlier post, some people's idea of safety is
facism, but that doesn't make all safety facist. Viz:
>...I have designed a language called Safer_C, and I
>will be presenting a paper called "Using Partial Evaluation in Support
>of Portability, Reusability, and Maintainability" at the International
>Conference on Compiler Construction CC'96 in Sweden in April. This
>paper proposes to use partial evaluation in place of a preprocessor
>phase.
Partial evaluation is *cool*. (And clean, for that matter.) Sounds
like you know what I'm saying better than I do.
--Steve
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.