[Types-sig] Pascal style declarations

Golden, Howard GoldenH@littoncorp.com
Tue, 14 Dec 1999 10:23:13 -0800


Since Guido hasn't had a coronary in response to my earlier suggestion, I
will be more specific:

1.  I propose _optional_ typing, using the Pascal syntax (since this seems
to me to be the most "Pythonic" (Isn't that like giving a snake an enema?
Sorry.).  Actually, I don't care about the specific syntax, just as long as
there is one.

2.  Specifically, you can declare a variable using the syntax:

    var x : int, y : string, ...

3.  In functions and methods, you can _optionally_ specify the argument
type:

    def funx(x : int, y : string): ...

4.  If you use these, then you are making binding assertions about the types
of the names, and these assertions can be checked at compile or run time.

5.  The parser could be made to strip out these declarations, and ignore
them, in which case they would have no effect.

6.  The parser should be modified so you can tell it (using a compile-time
switch or pragma) to require declarations.

7.  It appears to me that this would not change existing code, except if it
uses the name "var".

8.  I think there should be a parameterized type mechanism.  I don't much
like the angle bracket notation of C++, but I guess it's well established,
so it'll do.

In my opinion, this doesn't "muck up" the language (since you don't have to
use it).

---

Howard B. Golden
Software developer
Litton Industries, Inc.
Woodland Hills, California