digitalmars.D - re: PyD
- Neal Becker <ndbecker2 gmail.com> Feb 23 2012
- Ellery Newcomer <ellery-newcomer utulsa.edu> Feb 23 2012
- Ellery Newcomer <ellery-newcomer utulsa.edu> Feb 23 2012
- Ellery Newcomer <ellery-newcomer utulsa.edu> Feb 24 2012
- Jonathan M Davis <jmdavisProg gmx.com> Feb 23 2012
--0016e6d77c43aab85404b9a60319 Content-Type: text/plain; charset=ISO-8859-1 I'm interested in using it! I want to write python extension libs in D. --0016e6d77c43aab85404b9a60319 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'm interested in using it! =A0I want to write python extension libs in= D. --0016e6d77c43aab85404b9a60319--
Feb 23 2012
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
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
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
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









Ellery Newcomer <ellery-newcomer utulsa.edu> 