View mode: basic / threaded / horizontal-split · Log in · Help
February 23, 2012
re: PyD
I'm interested in using it!  I want to write python extension libs in D.
February 24, 2012
Re: PyD
Well, I can't make any promises, but you can try this:

https://bitbucket.org/ariovistus/pyd

it seems not to be compiling with the 2.058 front end, but I think it 
should with the 2.057 front end and ldc.

python headers are updated to support 2.5 thru 2.7, though I only tested 
with 2.7

good luck!

On 02/23/2012 12:43 PM, Neal Becker wrote:
> I'm interested in using it!  I want to write python extension libs in D.
February 24, 2012
Re: PyD
On 02/23/2012 11:40 PM, Ellery Newcomer wrote:
> Well, I can't make any promises, but you can try this:
>
> https://bitbucket.org/ariovistus/pyd
>
> it seems not to be compiling with the 2.058 front end, but I think it
> should with the 2.057 front end and ldc.

crumb, I take that back

Anyone know why following code gives

test.d(5): Error: f.fn() is not an lvalue



import std.traits;
template _py(Dg){
    Dg func(){
        F f = new F();
        return &f.fn!(ReturnType!Dg);
    }
}

class F{
    Tr fn(Tr, T ...)(T t){
    }
}

void main(){
    alias _py!(void delegate()) tz;
}
February 24, 2012
Re: PyD
On Thursday, February 23, 2012 23:52:09 Ellery Newcomer wrote:
> On 02/23/2012 11:40 PM, Ellery Newcomer wrote:
> > Well, I can't make any promises, but you can try this:
> > 
> > https://bitbucket.org/ariovistus/pyd
> > 
> > it seems not to be compiling with the 2.058 front end, but I think it
> > should with the 2.057 front end and ldc.
> 
> crumb, I take that back
> 
> Anyone know why following code gives
> 
> test.d(5): Error: f.fn() is not an lvalue
> 
> 
> 
> import std.traits;
> template _py(Dg){
>      Dg func(){
>          F f = new F();
>          return &f.fn!(ReturnType!Dg);
>      }
> }
> 
> class F{
>      Tr fn(Tr, T ...)(T t){
>      }
> }
> 
> void main(){
>      alias _py!(void delegate()) tz;
> }

Because like the error says, it's not an lvalue. fn returns a Tr, not a ref 
Tr. It's a temporary. And you can't take the address of a temporary.

Even worse, it looks like Tr is actually void, because fn is being passed 
ReturnType!Dg, and the delegate passed in is void. So, fn returns void, and 
then func tries to take the address of a void return value, which makes no 
sense.

- Jonathan M Davis
February 24, 2012
Re: PyD
On 02/23/2012 11:40 PM, Ellery Newcomer wrote:
>
> it seems not to be compiling with the 2.058 front end

3 (4 but for a segfault during shutdown) out of the 5 examples compile 
with 2.058 and run!
Top | Discussion index | About this forum | D home