Python from Wise Guy's Viewpoint
Andreas Rossberg
rossberg at ps.uni-sb.de
Tue Oct 28 08:00:58 EST 2003
prunesquallor at comcast.net wrote:
> "Marshall Spight" <mspight at dnai.com> writes:
>
>>It would be really interesting to see a small but useful example
>>of a program that will not pass a statically typed language.
>>It seems to me that how easy it is to generate such programs
>>will be an interesting metric.
>
> Would this count?
>
> (defun noisy-apply (f arglist)
> (format t "I am now about to apply ~s to ~s" f arglist)
> (apply f arglist))
Moscow ML version 2.00 (June 2000)
Enter `quit();' to quit.
- fun noisyApply f x =
(print "I am about to apply "; printVal f;
print " to "; printVal x; print "\n";
f x);
> val ('a, 'b) noisyApply = fn : ('a -> 'b) -> 'a -> 'b
- noisyApply Math.sin Math.pi;
I am about to apply fn to 3.14159265359
> val it = 1.22460635382E~16 : real
In this example, printVal requires some runtime type information. But
that does in no way preclude static type checking.
--
Andreas Rossberg, rossberg at ps.uni-sb.de
"Computer games don't affect kids; I mean if Pac Man affected us
as kids, we would all be running around in darkened rooms, munching
magic pills, and listening to repetitive electronic music."
- Kristian Wilson, Nintendo Inc.
More information about the Python-list
mailing list