[Cython] template types

Hoyt Koepke hoytak at cs.ubc.ca
Tue May 5 17:40:40 CEST 2009


On Tue, May 5, 2009 at 4:07 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Dag Sverre Seljebotn wrote:
>> Before the C++ syntax sticks
>
> I actually think it makes sense. In declarations, the parameter can appear
> only behind type names, so parsing them would be trivial - except for
> cases where the type name appears in an expression:
>
>    isinstance(x, MyType<int>)
>    type_ref = MyType<int>  vs.  type_ref = SomeValue < something > 5
>
> Not sure if
>
>    type_ref = MyType[int]
>
> makes this any simpler - it may at least simplify the parser, although
> there might be further ambiguities with buffers, array sizes and indexing.

One other thing that you all might want to consider is D's syntax for
templates (http://www.digitalmars.com/d/2.0/templates-revisited.html).
 As much as I am familiar with C++ template stuff, I think it is much
better thought out than C++.  I know it's completely tangential to
python/C, but might be worth considering.

--Hoyt

++++++++++++++++++++++++++++++++++++++++++++++++
+ Hoyt Koepke
+ University of Washington Department of Statistics
+ http://www.stat.washington.edu/~hoytak/
+ hoytak at gmail.com
++++++++++++++++++++++++++++++++++++++++++


More information about the Cython-dev mailing list