[Python-Dev] Adding NewType() to PEP 484 (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Tue May 31 19:58:50 EDT 2016
- Previous message (by thread): [Python-Dev] Adding NewType() to PEP 484
- Next message (by thread): [Python-Dev] Adding NewType() to PEP 484
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 31 May 2016 3:12 pm, "Glenn Linderman" <v+python at g.nevcal.com> wrote:
On 5/31/2016 12:55 PM, rndblnch wrote:
Guido van Rossum <gvanrossum gmail.com> writes:
Also -- the most important thing. What to call these things? We're pretty much settled on the semantics and how to create them (A = NewType('A', int)) but what should we call types like A when we're talking about them? "New types" sounds awkward. back in high school, i was introduced to c programming with the "disciplined C" preprocessor [0]. it made the distinction between information type and representation type (e.g. between the semantic and the implementation). those new types where created using typedefs and were named 'parallel types' below is the relevant part of the dcc presentation: Interesting! Prior art. And parallel type isn't a bad name...
If I heard "parallel type", I'd assume it had something to do with parallel processing.
Of the options suggested so far, DistinctType seems the most promising to me.
Cheers, Nick.
""" a major innovation of Disciplined C is the notion of "parallel type", that allows a distinction between information type and representation type. The following: typedef int Tindex, Tval; typedef Tindex Trow, Tcol; creates four distinct types, but which all accept the same operations and the same constants as the "representation" type ('int' here). Tindex, Tval, Trow and Tcol are examples of "information" types, because they convey an idea of the semantics of the corresponding objects. For example, they may be put to use in a checkers playing program: Tval will name 'int's that represent values of checkers, Trow and Tcol, 'int's that represent row and column indexes, Tindex, generic type for indexes. Tindex, Tval, Trow and Tcol are called parallel types; in fact, a type T1 is said to be parallel to a type T2 iff both are defined through a chain of typedefs starting from the same 'baseType', with no intervening qualifier nor modifier (pointer/array/function decla- rator, see grammar in Appendix A). In other words, T and T2 must be strict synonyms of baseType. """ renaud 0. Disciplined C ACM SIGPLAN Notices Homepage archive Volume 30 Issue 12, Dec. 1995 Pages 43 - 50 http://dl.acm.org/citation.cfm?id=219726.219747 http://www.digiater.nl/openvms/freeware/v50/dcc/dcc-v27d/dccarticle.ps
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/v%2Bpython%40g.nevcal.com
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160601/6468b935/attachment.html>
- Previous message (by thread): [Python-Dev] Adding NewType() to PEP 484
- Next message (by thread): [Python-Dev] Adding NewType() to PEP 484
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]