OT: It is convert, not covert

2017-04-03 Thread Ali Çehreli via Digitalmars-d-learn
Covert has a very different meaning. :) Ali

Re: Covert a complex C header to D

2017-04-03 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 3 April 2017 at 11:18:21 UTC, Nicholas Wilson wrote: prefer template over string mixins where possible. This will make the code much more readable. My advise would be the opposite. templates put much more pressure on the compiler then string-mixins do. Also the code that templat

Issue in _d_dso_registry on Linux when unloading DSO's

2017-04-03 Thread Jeremy DeHaan via Digitalmars-d-learn
I'm running into this issue when I compile DRuntime in debug. In sections_elf_shared.d, there's an assert on line 454 (assert(pdso._tlsSize == _tlsRanges.back.length);). Because of this line, I get an assertion thrown, where the actual issue is that _tlsRanges is empty and thus has no "back". T

opDispatch/template get this

2017-04-03 Thread Inquie via Digitalmars-d-learn
I am using opDispatch to wrap function calls Error: 'this' is only defined in non-static member functions, not opDispatch!"foo" class X { auto localfoo() { return 3; } template opDispatch(string name, Args...) { static if (name == `foo`) { alias opDispatch = () { return th

Re: Write file at compile time?

2017-04-03 Thread Inquie via Digitalmars-d-learn
On Monday, 3 April 2017 at 19:34:36 UTC, Adam D. Ruppe wrote: On Monday, 3 April 2017 at 19:25:35 UTC, Inquie wrote: what if I don't care about security reasons? I'm only needing it for developmental purposes. Why does it have to be at compile time then? Just run an ordinary runtime program a

Re: Write file at compile time?

2017-04-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 3 April 2017 at 19:25:35 UTC, Inquie wrote: what if I don't care about security reasons? I'm only needing it for developmental purposes. Why does it have to be at compile time then? Just run an ordinary runtime program as part of your develop process; run a helper file in your make

Re: Write file at compile time?

2017-04-03 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 3 April 2017 at 19:32:40 UTC, Stefan Koch wrote: On Monday, 3 April 2017 at 19:25:35 UTC, Inquie wrote: On Monday, 3 April 2017 at 19:06:01 UTC, Meta wrote: On Sunday, 2 April 2017 at 19:42:52 UTC, Inquie wrote: I would like to write the output of a manifest constant at compile time

Re: Write file at compile time?

2017-04-03 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 3 April 2017 at 19:25:35 UTC, Inquie wrote: On Monday, 3 April 2017 at 19:06:01 UTC, Meta wrote: On Sunday, 2 April 2017 at 19:42:52 UTC, Inquie wrote: I would like to write the output of a manifest constant at compile time to a file instead of console using pragma(msg). Is this pos

Re: Write file at compile time?

2017-04-03 Thread Inquie via Digitalmars-d-learn
On Monday, 3 April 2017 at 19:06:01 UTC, Meta wrote: On Sunday, 2 April 2017 at 19:42:52 UTC, Inquie wrote: I would like to write the output of a manifest constant at compile time to a file instead of console using pragma(msg). Is this possible? D does not allow IO at compile time for securit

Re: Write file at compile time?

2017-04-03 Thread Meta via Digitalmars-d-learn
On Sunday, 2 April 2017 at 19:42:52 UTC, Inquie wrote: I would like to write the output of a manifest constant at compile time to a file instead of console using pragma(msg). Is this possible? D does not allow IO at compile time for security reasons.

Re: how to make interface with return auto

2017-04-03 Thread Kagamin via Digitalmars-d-learn
Or if you want to completely abstract it: https://forum.dlang.org/post/iqxkelatusfocfotp...@forum.dlang.org

Re: how to make interface with return auto

2017-04-03 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 3 April 2017 at 12:42:02 UTC, Eko Wahyudin wrote: I know it's imposible. is there's a way if i want to create an interface that have method with return type value is equals with return type of std.palallelism.task eg. interface IWorker{ auto activate(); //on implementation clas

how to make interface with return auto

2017-04-03 Thread Eko Wahyudin via Digitalmars-d-learn
I know it's imposible. is there's a way if i want to create an interface that have method with return type value is equals with return type of std.palallelism.task eg. interface IWorker{ auto activate(); //on implementation class activate return std.parallelism.task } What is the replac

Re: delegate with optional parameters

2017-04-03 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 3 April 2017 at 05:00:15 UTC, Inquie wrote: Yes, but they are really not any different. They only look different. A field can be a function just like a method because they look exactly the same except on is in a vtable and the other is in the fields memory. But both point functions.

Re: Covert a complex C header to D

2017-04-03 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 3 April 2017 at 10:04:53 UTC, biocyberman wrote: On Monday, 3 April 2017 at 00:00:04 UTC, Nicholas Wilson wrote: On Sunday, 2 April 2017 at 21:43:52 UTC, biocyberman wrote: template __KHASH_TYPE(string name){ "struct kh_" ~ name ~"_t { " ~ "khint_t n_buckets, size,

Re: Covert a complex C header to D

2017-04-03 Thread biocyberman via Digitalmars-d-learn
On Monday, 3 April 2017 at 00:00:04 UTC, Nicholas Wilson wrote: On Sunday, 2 April 2017 at 21:43:52 UTC, biocyberman wrote: template __KHASH_TYPE(string name){ "struct kh_" ~ name ~"_t { " ~ "khint_t n_buckets, size, n_occupied, upper_bound; " ~ "khint32_t *f

Re: Interfacing C++ to D

2017-04-03 Thread ANtlord via Digitalmars-d-learn
On Sunday, 2 April 2017 at 16:03:51 UTC, FreeSlave wrote: Funny thing: If I replace interface with abstract class, it works as it should. Also I noticed that removing inheritance in library and in application makes unexpected results. When I try to output field `field` I get incorrect rando