[Cython] Fused Types

Robert Bradshaw robertwb at math.washington.edu
Tue May 3 20:19:10 CEST 2011


On Tue, May 3, 2011 at 10:06 AM, mark florisson
<markflorisson88 at gmail.com> wrote:
> On 3 May 2011 18:00, Robert Bradshaw <robertwb at math.washington.edu> wrote:
>> floating is implicitly available, we could require making it explicit.
>
> How would we make it explicit.

Require the parameterization, i.e.

    floating_p[floating]

would be the as-yet-unspecified type. In this particular example, it
does seem unnecessarily verbose. Without it, one would have to know
that

    cdef object foo(Vector v):
        ...

may depend on floating if Vector does.


On Tue, May 3, 2011 at 10:52 AM, Dag Sverre Seljebotn
<d.s.seljebotn at astro.uio.no> wrote:
> I was wrong. We need
>
> cdef f(floating x, floating_p y)
>
> ...to get 2 specializations, not 4. And the rest follows from there. So I'm
> with Robert's real stance :-)
>
> I don't think we want flexibility, we want simplicity over all. You can
> always use a templating language.

+1

> Btw we shouldn't count on pruning for the design of this, I think this will
> for a large part be used with def functions. And if you use a cdef function
> from another module through a pxd, you also need all versions.

Well, we'll want to avoid compiler warnings. E.g. floating might
include long double, but only float and double may be used. In pxd and
def functions, however, we will make all versions available.

- Robert


More information about the cython-devel mailing list