www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - re: PyD

reply Neal Becker <ndbecker2 gmail.com> writes:
I'm interested in using it!  I want to write python extension libs in D.
Feb 23 2012
parent reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
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.
Feb 23 2012
next sibling parent reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
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; }
Feb 23 2012
parent Jonathan M Davis <jmdavisProg gmx.com> writes:
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
Feb 23 2012
prev sibling parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
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!
Feb 24 2012