opacity and static typing (Re: Type checkers for scheme) 
Author Message
 opacity and static typing (Re: Type checkers for scheme)


   >C: The point of type checking is to allow the programmer to protect his
   >abstractions.  I should be able to write an implementation of stacks
   >as arrays, and ensure that my client can't replace the 13th element in
                   ^^^^^^                ^^^^^
   >the stack, can't update the stack without acquiring the appropriate lock,
               ^^^^^
   >etc.

   Well at least he's honest.

   I'm tempted to just leave it at that -- I think this speaks for itself -- but
   then my Pnews will tell me I'm quoting more lines than I'm adding, so I'll
   restate the obvious:  Type systems are designed to impose restrictions on
   programmers.  Programmer A thinks that programmer B is an idiot so s/he
   chooses a programming language that ENSURES that programmer B CAN'T do anything
   that programmer A doesn't like.

Well, Programmer A (myself) thinks that Programmer A (myself) is an
idiot at times (in particular, after having sat at the terminal for
many hours). That's why Programmer A likes to be able to leave certain
clearcut reminders in his code that certain things should not be
done.

Please get it out of your head that a static type checker is an
absolute protection against shooting yourself (or someone else) in the
foot. It's an added capability of the compiler with additional
notation for letting you state and check certain properties of your
programs at compile time. If you want to shoot yourself in the foot,
you can, even with a static type checker (although, luckily, most
statically typed languages have chosen notation that makes this
relatively cumbersome).

The issue of enforcing abstractness or opacity of datatypes is
orthogonal to the question of static vs. dynamic typing. Even Scheme
has a (limited) form of opaque datatypes in the form of closures,
despite its "everything is accessible" philosophy (no doubt, this will
be fixed sooner or later), and there have even been proposals to add
more explicit support. On the other hand, C and (in particular) Pascal
have only extremely limited facilities for making datatypes opaque,
despite their extremely rigid static type systems.

                                        Thomas.



Sun, 20 Nov 1994 05:58:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Static type checker for Python

2. ML-like type-checker for Scheme subset?

3. ML-like type-checker for Scheme subset?

4. Types, types: static vs. dynamic -- classification

5. Types, types: static vs. dynamic --

6. Types, types: static vs. dynamic -- classification

7. x/0 as a type error [Extremely static typing]

8. Types, types: static vs. dynamic -- classification

9. Provide an option: static typing + type inference ?

10. Flying With Python (Strong versus Weak Typing) [actually, Static vs Dynamic typing]

11. ML as Scheme: Dynamic typing in a strongly-typed language

 

 
Powered by phpBB® Forum Software