Re: Using python in D

2019-06-08 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-06-07 at 14:02 +, rnd via Digitalmars-d-learn wrote: This being D meets Python, I thought I'd take a look at this one. > I tried following in dub.selections.json file: > > { > "fileVersion": 1, > "versions": { > "pyd": "0.10.5" > }, >

Re: if (X !is null && X.Y !is null) access crash

2019-06-08 Thread Amex via Digitalmars-d-learn
On Friday, 7 June 2019 at 16:09:47 UTC, Adam D. Ruppe wrote: It happens when I close down my app. is this inside a destructor? No, it's in an external thread(it is in a callback). All I can think of is that something is happening in between the two checks since there is no way it could

Re: Using python in D

2019-06-08 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2019-06-08 at 16:53 +, rnd via Digitalmars-d-learn wrote: > […] > I did not delete Python2.7 since I thought there could be some > part of Debian/installed package that may depend on it. But I > will try to do it now. I overstated the case a bit. I do not use Python 2.7 but there

Re: if (X !is null && X.Y !is null) access crash

2019-06-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/8/19 2:28 AM, Amex wrote: On Friday, 7 June 2019 at 16:09:47 UTC, Adam D. Ruppe wrote: It happens when I close down my app. is this inside a destructor? No, it's in an external thread(it is in a callback). All I can think of is that something is happening in between the two checks

Re: FieldNameTuple!T and std.traits.Fields!T not empty for interfaces

2019-06-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/6/19 5:36 PM, Jonathan M Davis wrote: On Thursday, June 6, 2019 2:52:42 PM MDT Steven Schveighoffer via Digitalmars-d-learn wrote: On 6/6/19 4:49 PM, Steven Schveighoffer wrote: Oh wait! It's not empty, it has an empty string as a single member! That's definitely a bug. OK, not a bug,

check if _argument[0] is a descendant of a specific class.

2019-06-08 Thread realhet via Digitalmars-d-learn
Hi, I'm googling since an hour but this is too much for me: class A{} class B:A{} void foo(...){ if(_arguments[0]==typeid(A)){ //obviously not works for B } if(_arguments[0] is_a_descendant_of A){ //how to make it work for both A and B? } }

Re: check if _argument[0] is a descendant of a specific class.

2019-06-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 8 June 2019 at 21:16:14 UTC, realhet wrote: void foo(...){ Do you have to use the variadic thing? It is easy to do with template variadic or with just regular arrays of interfaces/base classes. I just wanna check if a compile_time _argument[0] is a descendant of a class or

Re: check if _argument[0] is a descendant of a specific class.

2019-06-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 8 June 2019 at 21:24:53 UTC, Adam D. Ruppe wrote: _arguments is a compile time construct, it is a run time thing. err i meant is *NOT* a compile time construct

Re: Using python in D

2019-06-08 Thread rnd via Digitalmars-d-learn
On Saturday, 8 June 2019 at 09:11:48 UTC, Russel Winder wrote: ... ... The problem seems to be that PyD is not looking in the right place for importing packages, but this is pure speculation. Perhaps this merits a bug report against the PyD source repository? Thanks for your time, effort

Re: if (X !is null && X.Y !is null) access crash

2019-06-08 Thread Amex via Digitalmars-d-learn
On Saturday, 8 June 2019 at 20:44:13 UTC, Steven Schveighoffer wrote: On 6/8/19 2:28 AM, Amex wrote: On Friday, 7 June 2019 at 16:09:47 UTC, Adam D. Ruppe wrote: It happens when I close down my app. is this inside a destructor? No, it's in an external thread(it is in a callback). All I can

Can D optimize?

2019-06-08 Thread Amex via Digitalmars-d-learn
Can dmd or ldc optimize the following cases: foo(int x) { if (x > 10 && x < 100) bar1; else bar2; } ... for(int i = 23; i < 55; i++) foo(i); // equivalent to calling bar1(i) clearly i is within the range of the if in foo and so the checks are unnecessary. I realize that this is

Re: Using python in D

2019-06-08 Thread rnd via Digitalmars-d-learn
On Saturday, 8 June 2019 at 19:35:00 UTC, Russel Winder wrote: PyD is hosted on GitHub so it is a question of putting in an issue there: https://github.com/ariovistus/pyd/issues The best bet is to write up what you have presented on email here, and then let the PyD developers guide

Re: check if _argument[0] is a descendant of a specific class.

2019-06-08 Thread realhet via Digitalmars-d-learn
On Saturday, 8 June 2019 at 21:25:41 UTC, Adam D. Ruppe wrote: On Saturday, 8 June 2019 at 21:24:53 UTC, Adam D. Ruppe wrote: _arguments is a compile time construct, it is a run time thing. err i meant is *NOT* a compile time construct Thank You for the fast help! At first I was happy to