Re: [Python-Dev] Adding NewType() to PEP 484

2016-05-31 Thread rndblnch
Guido van Rossum  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:

"""
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-v2_7d/dccarticle.ps

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Adding NewType() to PEP 484

2016-05-31 Thread Glenn Linderman

On 5/31/2016 12:55 PM, rndblnch wrote:

Guido van Rossum  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...



"""
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-v2_7d/dccarticle.ps

___
Python-Dev mailing list
[email protected]
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
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Adding NewType() to PEP 484

2016-05-31 Thread Nick Coghlan
On 31 May 2016 3:12 pm, "Glenn Linderman"  wrote:
>
> On 5/31/2016 12:55 PM, rndblnch wrote:
>>
>> Guido van Rossum  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-v2_7d/dccarticle.ps
>>
>> ___
>> Python-Dev mailing list
>> [email protected]
>> 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
> [email protected]
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
>
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Adding NewType() to PEP 484

2016-05-31 Thread Glenn Linderman

On 5/31/2016 4:58 PM, Nick Coghlan wrote:



On 31 May 2016 3:12 pm, "Glenn Linderman" > wrote:

>
> On 5/31/2016 12:55 PM, rndblnch wrote:
>>
>> Guido van Rossum  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.




Google seems to think so also... "Disciplined C" probably predates 
parallel processing, but adding disciplined C preprocessor to the search 
does find a document about the preprocessor in the same sense used by 
@rndblnch. And the types do have "parallel" behavior... every behavior 
of one is found identically in the other. So it makes sense, but it 
would be hard to find the prior art without extra information, as the 
term is now overwhelmed by "Parallel Type-checking" for parallel processing.


Still, some mention should probably be made of "parallel type in the 
'Disciplined C preprocessor' " in the "prior art" category of PEP 484.


From reading about Disciplined C, would seem that this feature could be 
used as a foundation to add "units" support to variables, validated only 
by a type checker, and thus having no runtime overhead, although it 
would take some more features from Disciplined C, regarding the 
definition of legal combinations of types and operations.


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-v2_7d/dccarticle.ps
>>
>> ___
>> Python-Dev mailing list
>> [email protected] 
>> 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
> [email protected] 
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com

>



___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Adding NewType() to PEP 484

2016-05-31 Thread Bernardo Sulzbach

On 05/31/2016 08:58 PM, Nick Coghlan wrote:

On 31 May 2016 3:12 pm, "Glenn Linderman"  wrote:


On 5/31/2016 12:55 PM, rndblnch wrote:


Guido van Rossum  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.



This also happens to me every time I read it.


___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com