Re: type keyword proposal
"Mark Hahn" <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mark Hahn wrote: > ---- Type Proposal ---- > > type var1:proto1, (var2,var3):proto2, var4:(proto3, proto4) > > If any var does not have the prototype after the colon (or one of the > prototypes in the tuple) in the var's prototype chain, then a > TypeError exception will be thrown. > > This would usually be used immediately after the docstring in a > function on the params of the function, but could be used anywhere at > any time on any vars. > > def func(a, b, c): > "a function" > type (a,b):int, c:(String, List) > > Note that this would be the preferred way to document the types for > the auto-doc generator also. Note also the similarity to the > original C typing where the type was after the param list. > > Comments? Votes? Warning. I consider no response to be a default acceptance :-) I'll implement this if no one complains.