Re: Get UDA of unit tests during Runtime.moduleUnitTester

2017-07-25 Thread Seb via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 03:27:30 UTC, Matthew Remmel wrote: I'd like to print out the name given to a unit test via a UDA, as the tests are being ran by the Runtime.moduleUnitTester. I'm working on writing a custom unit test runner. It would seem that the ModuleInfo.unitTest property is

Get UDA of unit tests during Runtime.moduleUnitTester

2017-07-25 Thread Matthew Remmel via Digitalmars-d-learn
I'd like to print out the name given to a unit test via a UDA, as the tests are being ran by the Runtime.moduleUnitTester. I'm working on writing a custom unit test runner. It would seem that the ModuleInfo.unitTest property is an aggregated function of all the individual unit test blocks in a

Re: I feel the dynamic array .sizeof property is kind of a bait and switch

2017-07-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 02:24:06 UTC, WhatMeForget wrote: Static Arrays have property .sizeof which returns the array length multiplied by the number of bytes per array element. Dynamic Arrays have property .sizeof which returns the size of the dynamic array reference, which is 8 in

Re: I feel the dynamic array .sizeof property is kind of a bait and switch

2017-07-25 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 02:24:06 UTC, WhatMeForget wrote: Static Arrays have property .sizeof which returns the array length multiplied by the number of bytes per array element. Dynamic Arrays have property .sizeof which returns the size of the dynamic array reference, which is 8 in

I feel the dynamic array .sizeof property is kind of a bait and switch

2017-07-25 Thread WhatMeForget via Digitalmars-d-learn
Static Arrays have property .sizeof which returns the array length multiplied by the number of bytes per array element. Dynamic Arrays have property .sizeof which returns the size of the dynamic array reference, which is 8 in 32-bit builds and 16 on 64-bit builds. Why not have dynamic

Re: Cast to subclass in the dmd compiler

2017-07-25 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 21:06:25 UTC, unDEFER wrote: I have found the answer in the code. Right code is: Import imp = m.isImport(); if (imp !is null) Thank you. grep for kluge in code, you'll find all the places it does its own RTTI.

Re: Crypto.lib and ssl.lib for Win32

2017-07-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 12:11:08 UTC, MGW wrote: Where can I find the ready made for usage or how to create cryptro.lib and ssl.lib for Windows 32 that are necessary for my project? Do you have the crypto.dll and ssl.dll? If so, implib can make the lib files. If you don't have implib,

Re: Cast to subclass in the dmd compiler

2017-07-25 Thread unDEFER via Digitalmars-d-learn
I have found the answer in the code. Right code is: Import imp = m.isImport(); if (imp !is null) Thank you.

Re: Cast to subclass in the dmd compiler

2017-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/25/17 4:36 PM, unDEFER wrote: Hello! I'm hacking dmd compiler and trying to look on members array just after parse module. for(uint i = 0; i < members.dim; i++) { Dsymbol m = (*members)[i]; // It is good, but further: Import imp = cast(Import) m; if (imp !is null)

Cast to subclass in the dmd compiler

2017-07-25 Thread unDEFER via Digitalmars-d-learn
Hello! I'm hacking dmd compiler and trying to look on members array just after parse module. for(uint i = 0; i < members.dim; i++) { Dsymbol m = (*members)[i]; // It is good, but further: Import imp = cast(Import) m; if (imp !is null) { printf(" import %s.%s\n",

Re: unittest-cov - results?

2017-07-25 Thread 0xEAB via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 19:13:21 UTC, Jolly James wrote: On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote: On Wednesday, July 05, 2017 18:50:32 Jolly James via Digitalmars-d-learn wrote: On Wednesday, 5 July 2017 at 18:46:38 UTC, Jolly James wrote: > [...] I have changed

Re: GtkD on android?

2017-07-25 Thread Joakim via Digitalmars-d-learn
On Saturday, 22 July 2017 at 18:59:44 UTC, FoxyBrown wrote: With LDC's new ability to do android/arm, we are missing the ability to do GUI's? Can any of the current D solutions work such as GtkD or QtD? I'm looking for something somewhat lightweight, easy to use(I find GtkD a bit funky but it

Re: Prevent destroy() from calling base deconstructor of a derived class?

2017-07-25 Thread Moritz Maxeiner via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 17:50:18 UTC, Dragonson wrote: I need to call only the deconstructor of the derived class I have an instance of, not every deconstructor in the inheritance chain. Putting `override` before the destructor doesn't compile so I'm not sure how to achieve this? Call

Prevent destroy() from calling base deconstructor of a derived class?

2017-07-25 Thread Dragonson via Digitalmars-d-learn
I need to call only the deconstructor of the derived class I have an instance of, not every deconstructor in the inheritance chain. Putting `override` before the destructor doesn't compile so I'm not sure how to achieve this?

Re: Why structs and classes instanciations are made differently ?

2017-07-25 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 15:56:45 UTC, Houdini wrote: Yes, but it isn't the default way in C++ to do dynamic instanciation. https://github.com/isocpp/CppCoreGuidelines this? It's only 2 years old. The new operator predates it by decades.

Re: Why structs and classes instanciations are made differently ?

2017-07-25 Thread Houdini via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 15:15:59 UTC, Kagamin wrote: C++ is big, there's always something you don't know about it. Java actually instantiates classes the C++ way: http://en.cppreference.com/w/cpp/language/new Yes, but it isn't the default way in C++ to do dynamic instanciation. Usually,

Re: VibeD - takeing out value from json

2017-07-25 Thread holo via Digitalmars-d-learn
There was need to change one line from: auto header = result["heading"].to!string; to: auto header = result[0]["heading"].to!string;

Re: Why structs and classes instanciations are made differently ?

2017-07-25 Thread Kagamin via Digitalmars-d-learn
On Monday, 24 July 2017 at 15:21:54 UTC, Houdini wrote: D is very similar to C++ (and also grabs godd ideas from Python), but I have a naive question : why does Walter Bright chose to instanciate classes like in Java ? C++ is big, there's always something you don't know about it. Java

Re: unittest blocks not being run inside of class and struct templates

2017-07-25 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 02:48:57 UTC, NoBigDeal256 wrote: What is the standard way of testing class templates in the context of a library where some of the classes may never actually be used by the library itself? Write a test and instantiate whatever templates you want to test. class

Re: Append to dynamic array that was allocated via calloc

2017-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/25/17 8:40 AM, John Burton wrote: I can create a "slice" using non-gc allocated memory. int* ptr = cast(int*)calloc(int.sizeof, 10); int[] data = ptr[0..10]; If I don't want a memory leak I have to call free(ptr) somewhere as it won't be GC collected when data or ptr go

Re: unittest blocks not being run inside of class and struct templates

2017-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/24/17 11:13 PM, NoBigDeal256 wrote: On Tuesday, 25 July 2017 at 02:18:41 UTC, Adam D. Ruppe wrote: On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote: it passes when it should fail because the unittest block is never executed. Why is this? Did you actually instantiate the

Re: Append to dynamic array that was allocated via calloc

2017-07-25 Thread John Burton via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 13:24:36 UTC, Mike Parker wrote: On Tuesday, 25 July 2017 at 12:40:13 UTC, John Burton wrote: [...] This should give you the answer: writefln("Before: ptr = %s capacity = %s", slice.ptr, slice.capacity); slice ~= 1; writefln("After: ptr = %s capacity = %s",

Re: Append to dynamic array that was allocated via calloc

2017-07-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 12:40:13 UTC, John Burton wrote: I can create a "slice" using non-gc allocated memory. int* ptr = cast(int*)calloc(int.sizeof, 10); int[] data = ptr[0..10]; If I don't want a memory leak I have to call free(ptr) somewhere as it won't be GC collected

Re: Append to dynamic array that was allocated via calloc

2017-07-25 Thread Dukc via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 12:40:13 UTC, John Burton wrote: What happens? It seems to successfully append an extra value to the array. It appears to "work" when I try it in my compiler but I don't understand how. Will this be trying to write beyond the memory I calloc'ed? The language makes

Append to dynamic array that was allocated via calloc

2017-07-25 Thread John Burton via Digitalmars-d-learn
I can create a "slice" using non-gc allocated memory. int* ptr = cast(int*)calloc(int.sizeof, 10); int[] data = ptr[0..10]; If I don't want a memory leak I have to call free(ptr) somewhere as it won't be GC collected when data or ptr go out of scope. I presume there is nothing

Crypto.lib and ssl.lib for Win32

2017-07-25 Thread MGW via Digitalmars-d-learn
I want to make an application with use http2.d from packet arsd. Where can I find the ready made for usage or how to create cryptro.lib and ssl.lib for Windows 32 that are necessary for my project?

Re: traits compiles does not work for symbols from other modules

2017-07-25 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 11:34:23 UTC, Andre Pany wrote: On Tuesday, 25 July 2017 at 08:30:43 UTC, ag0aep6g wrote: Works for me. What compiler are you using? I reduced the example too lot. The issue is occuring if there is also a package.d is involved. m1.d ---

Re: traits compiles does not work for symbols from other modules

2017-07-25 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 08:30:43 UTC, ag0aep6g wrote: Works for me. What compiler are you using? I reduced the example too lot. The issue is occuring if there is also a package.d is involved. m1.d --- module m1; import sub; // Does not throw if replaced with:

Re: How to make autocompletion for IDE?

2017-07-25 Thread unDEFER via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:42:40 UTC, Basile B. wrote: I think that you underestimate the amount of work needed and your solution which is to use the compiler with -o- looks bad. What you really need is a compiler front-end which is basically what libdparse + DSymbol are. DCD uses them.

Re: How to make autocompletion for IDE?

2017-07-25 Thread unDEFER via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:35:14 UTC, Andrea Fontana wrote: If you want to add UFCS suggestions to DCD it would be useful for your project and all other IDEs too! Andrea Thank you, I will think. But if it was easy, authors self would do it :-)

Re: How to make autocompletion for IDE?

2017-07-25 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:32:11 UTC, unDEFER wrote: On Tuesday, 25 July 2017 at 10:24:13 UTC, Andrea Fontana wrote: On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote: On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote: Any ideas? I think you should use/contribute to

Re: How to make autocompletion for IDE?

2017-07-25 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:32:11 UTC, unDEFER wrote: Yes this project where "Not working: UFCS suggestions and That one feature that you REALLY needed".. I want to have all features that I really need :-) But If I will not find how do UFCS suggestions fast, I probably will use DCD for all

Re: How to make autocompletion for IDE?

2017-07-25 Thread unDEFER via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:24:13 UTC, Andrea Fontana wrote: On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote: On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote: Any ideas? I think you should use/contribute to DCD project https://github.com/dlang-community/DCC Andrea

VibeD - takeing out value from json

2017-07-25 Thread holo via Digitalmars-d-learn
Hello I wrote such code to test restAPI client: /// //app.d /// import vibe.d; import sites.frontpage; import msfrontpage; shared static this() { // the router will match incoming HTTP requests to the proper routes auto router = new URLRouter; // registers each

Re: How to make autocompletion for IDE?

2017-07-25 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote: On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote: Any ideas? I think you should use/contribute to DCD project https://github.com/dlang-community/DCC Andrea Sorry, this is the right link:

Re: How to make autocompletion for IDE?

2017-07-25 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote: Any ideas? I think you should use/contribute to DCD project https://github.com/dlang-community/DCC Andrea

How to make autocompletion for IDE?

2017-07-25 Thread unDEFER via Digitalmars-d-learn
Hello! I have written my text editor with highlighting, and now I want to add IDE features to it. I want to make autocompletion, but not only complete members of class/struct, but also all functions which maybe used with type, if the first argument of the function is this type. I.e. in

Re: traits compiles does not work for symbols from other modules

2017-07-25 Thread ag0aep6g via Digitalmars-d-learn
On 07/24/2017 11:40 PM, Andre Pany wrote: m1.d - module m1; import m2; class Foo { int foo; } void main() { static assert(__traits(compiles, m1.Foo.foo)); static assert(__traits(compiles, m2.Bar.bar)); } m2.d --- module m2; class Bar { int

Re: Why structs and classes instanciations are made differently ?

2017-07-25 Thread Houdini via Digitalmars-d-learn
On Monday, 24 July 2017 at 17:42:30 UTC, Steven Schveighoffer wrote: In D, I would use classes for any time I need polymorphism, and use structs otherwise. OK, I'll adhere to this method. :) Thanks to all for your answers.

Re: How does one determine the UDAs of all symbols contained in a given module?

2017-07-25 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-21 06:16, Andrew Edwards wrote: Thanks... Minus the AliasSeq bit, this is pretty much what I've been working with since talking to Brain. The main problem I'm facing is that it fails to compileif any of the symbols in the imported module is marked private. Ah, yes. That's a known