Re: Get module file path from ModuleInfo

2019-06-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-06-06 12:43, Andre Pany wrote: Also __traits(getUnitTests) does not return the module file name. The approach above is working fine in the d-unit library (https://code.dlang.org/packages/d-unit) Well, to use __traits(getUnitTests) you need to collect all the files and generate a new

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Friday, 7 June 2019 at 16:41:12 UTC, Adam D. Ruppe wrote: On Friday, 7 June 2019 at 16:33:13 UTC, Machine Code wrote: All this effort is because I do not want unittest code in a release or even debug. Well, that part is easy: version(unittest) struct Foo {} at any scope is only build

Re: Why this fails when using unittest?

2019-06-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 7 June 2019 at 16:33:13 UTC, Machine Code wrote: All this effort is because I do not want unittest code in a release or even debug. Well, that part is easy: version(unittest) struct Foo {} at any scope is only build when unittests are turned on in this build.

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Friday, 7 June 2019 at 16:30:34 UTC, Machine Code wrote: On Thursday, 6 June 2019 at 21:02:37 UTC, Steven Schveighoffer wrote: [...] Intesting, I also tried to declare it inside a function, that did not work either. Is this hidden context pointer a current limitation in CTFE? I've tried

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Thursday, 6 June 2019 at 21:02:37 UTC, Steven Schveighoffer wrote: On 6/6/19 1:49 PM, Adam D. Ruppe wrote: On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote: outside an unittest, this compiles fine: struct A try making it `static struct` instead cannot implicitly convert

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Thursday, 6 June 2019 at 17:49:58 UTC, Adam D. Ruppe wrote: On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote: outside an unittest, this compiles fine: struct A try making it `static struct` instead didn't work either cannot implicitly convert expression "hehe" of

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

2019-06-07 Thread Adam D. Ruppe via Digitalmars-d-learn
It happens when I close down my app. is this inside a destructor?

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

2019-06-07 Thread Amex via Digitalmars-d-learn
On Friday, 7 June 2019 at 14:07:34 UTC, KnightMare wrote: On Friday, 7 June 2019 at 09:26:52 UTC, Amex wrote: if (X !is null && X.Y !is null) access crash is crashing. imo this code is valid. u can write shorter if (X && X.Y) probably crashed in some another place (X is not objRef but

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

2019-06-07 Thread KnightMare via Digitalmars-d-learn
On Friday, 7 June 2019 at 09:26:52 UTC, Amex wrote: if (X !is null && X.Y !is null) access crash is crashing. imo this code is valid. u can write shorter if (X && X.Y) probably crashed in some another place (X is not objRef but something else.. some code later at same line.. dunno)

Re: Using python in D

2019-06-07 Thread rnd via Digitalmars-d-learn
On Friday, 7 June 2019 at 10:55:22 UTC, JN wrote: On Friday, 7 June 2019 at 05:04:30 UTC, rnd wrote: On Friday, 7 June 2019 at 04:39:14 UTC, rikki cattermole wrote: On 07/06/2019 3:54 PM, rnd wrote: How should I 'initialize python' ? The example is probably a good place to begin.

Re: Using python in D

2019-06-07 Thread Rnd via Digitalmars-d-learn
On Friday, 7 June 2019 at 10:55:22 UTC, JN wrote: On Friday, 7 June 2019 at 05:04:30 UTC, rnd wrote: On Friday, 7 June 2019 at 04:39:14 UTC, rikki cattermole wrote: On 07/06/2019 3:54 PM, rnd wrote: How can I specify Python version 3 in pyd? https://github.com/ariovistus/pyd "To use with

Blog Post #0042 - File Dialog VIII - Custom Dialogs (1 of 3)

2019-06-07 Thread Ron Tarrant via Digitalmars-d-learn
Today starts a mini-series within a series about rolling yer own Dialogs. And because aesthetics is such a big part of doing layout, we start with a mini crash course in design. Here's the link: http://gtkdcoding.com/2019/06/07/0042-custom-dialog-i.html

Re: Using python in D

2019-06-07 Thread JN via Digitalmars-d-learn
On Friday, 7 June 2019 at 05:04:30 UTC, rnd wrote: On Friday, 7 June 2019 at 04:39:14 UTC, rikki cattermole wrote: On 07/06/2019 3:54 PM, rnd wrote: How should I 'initialize python' ? The example is probably a good place to begin.

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

2019-06-07 Thread Amex via Digitalmars-d-learn
On Thursday, 6 June 2019 at 20:52:42 UTC, Steven Schveighoffer 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, but not what I would have expected. From docs: "If T isn't a

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

2019-06-07 Thread Amex via Digitalmars-d-learn
I don't understand why if (X !is null && X.Y !is null) access crash is crashing. It is true that it is being used in a thread. It happens when I close down my app. The whole point of the check is to make sure X is not null but it seems to be failing. The debugger is showing X is not null