[Types-sig] Pascal style declarations

Greg Stein gstein@lyra.org
Tue, 14 Dec 1999 12:59:39 -0800 (PST)

You don't provide a way to declare function return value(s) types. When
you do, then I think you're going to run into a problem using the ':'
syntactical marker...

This was one reason that Fred/Sjoerd/myself moved away from ':'-based
declarations, and eventually fell into expression-based type checking.


On Tue, 14 Dec 1999, Golden, Howard wrote:

> 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
> _______________________________________________
> Types-SIG mailing list
> Types-SIG@python.org
> http://www.python.org/mailman/listinfo/types-sig

Greg Stein, http://www.lyra.org/