Re: Fiber based UI-Toolkit

2017-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-09 21:43, Christian Köstlin wrote: I wonder if there is any fiber based / fiber compatible UI-Toolkit out for dlang. The second question is, if it would make sense at all to have such a thing? If I recall correctly, vibe.d has some form of integration with the native GUI event loop

Re: Fiber based UI-Toolkit

2017-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-09 23:12, bauss wrote: I believe OSX (possibly macOS too.) only allows it from the main thread. Yes, that's correct. But what's the difference between OSX and macOS ;) -- /Jacob Carlborg

Re: Application settings

2017-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-07 21:40, FoxyBrown wrote: What's the "best" way to do this? I want something I can simply load at startup in a convenient and easy way then save when necessary(possibly be efficient at it, but probably doesn't matter). Simply json an array and save and load it, or is there a better

Get a string of a function name from a function pointer?

2017-07-10 Thread SauceKode via Digitalmars-d-learn
I need to pass a group of (C) function pointers to another language from D... is there a way to derrive a name from a function pointer? Or do I have to manually list out the names?

Re: Fiber based UI-Toolkit

2017-07-10 Thread Gerald via Digitalmars-d-learn
On Sunday, 9 July 2017 at 19:43:14 UTC, Christian Köstlin wrote: I wonder if there is any fiber based / fiber compatible UI-Toolkit out for dlang. The second question is, if it would make sense at all to have such a thing? As previously noted, like other UI toolkits GTK maintains a single thr

Re: Fiber based UI-Toolkit

2017-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-10 15:37, Gerald wrote: Having said that, I'm in the camp where this doesn't make much sense. Using fibers on the main UI thread is likely going to result in a blocked UI whenever a fiber takes too long to do its work. History has shown that cooperative multi-tasking typically doesn

Re: Fiber based UI-Toolkit

2017-07-10 Thread Christian Köstlin via Digitalmars-d-learn
On 10.07.17 15:37, Gerald wrote: > On Sunday, 9 July 2017 at 19:43:14 UTC, Christian Köstlin wrote: >> I wonder if there is any fiber based / fiber compatible UI-Toolkit out >> for dlang. The second question is, if it would make sense at all to >> have such a thing? > > As previously noted, like o

pure factory function vs immutable(Foo)**

2017-07-10 Thread ag0aep6g via Digitalmars-d-learn
I feel like I must be missing something here. This works: alias T = int; T** f(const T** input) pure { T** output; return output; } void main() { T i; T* p = &i; immutable T** r = f(&p); } `f` is `pure`, its parameter is const, and its return type has mutable in

Re: pure factory function vs immutable(Foo)**

2017-07-10 Thread drug via Digitalmars-d-learn
10.07.2017 17:57, ag0aep6g пишет: I feel like I must be missing something here. This works: alias T = int; T** f(const T** input) pure { T** output; return output; } void main() { T i; T* p = &i; immutable T** r = f(&p); } `f` is `pure`, its parameter is const,

Re: pure factory function vs immutable(Foo)**

2017-07-10 Thread ag0aep6g via Digitalmars-d-learn
On 07/10/2017 05:42 PM, drug wrote: 10.07.2017 17:57, ag0aep6g пишет: [...] The error message is: "cannot implicitly convert expression (f(& p)) of type immutable(int)** to immutable(int**)". [...] I'm not sure I understand, but ``` immutable (T)** r = f(&p); ``` compiles. So compiler complai

Re: problem overloading functions with complex enum type

2017-07-10 Thread Lamex via Digitalmars-d-learn
On Saturday, 8 July 2017 at 15:23:10 UTC, Eric wrote: import std.stdio; check check one two

Re: problem overloading functions with complex enum type

2017-07-10 Thread Ali Çehreli via Digitalmars-d-learn
On 07/08/2017 08:23 AM, Eric wrote: > enum AS : string[2] { a = ["1","2"], b = ["3","4"] }; > enum BS : string[2] { a = ["5","6"], b = ["7","8"] }; > > void funcs(AS a) { writeln("AS"); } > void funcs(BS b) { writeln("BS"); } > funcs(AS.a); // compiler error: matches both funcs(AS) and func

Re: Get a string of a function name from a function pointer?

2017-07-10 Thread Ali Çehreli via Digitalmars-d-learn
On 07/10/2017 05:26 AM, SauceKode wrote: > I need to pass a group of (C) function pointers to another language from > D... is there a way to derrive a name from a function pointer? Or do I > have to manually list out the names? libunwind should be able to provide that functionality. Otherwise, no

Re: Is runtime info in shared memory?

2017-07-10 Thread Ali Çehreli via Digitalmars-d-learn
On 07/09/2017 02:38 AM, Jean-Louis Leroy wrote: When I look at ldc2's object.d I have the impression it's thread local. I may be wrong though, just beginning to learn about 'shared'. Unless it's marked as shared or __gshared it's thread-local by default. Ali

Re: CTFE output is kind of weired

2017-07-10 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jul 09, 2017 at 06:48:30AM +, Stefan Koch via Digitalmars-d-learn wrote: > On Sunday, 9 July 2017 at 04:03:09 UTC, H. S. Teoh wrote: [...] > > Stefan Koch allegedly will add a ctfeWriteln to his new CTFE engine > > that should alleviate this limitation. > > > > > > T > > In fact ctf

Re: iterate over variadic

2017-07-10 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jul 09, 2017 at 10:21:59PM +, FoxyBrown via Digitalmars-d-learn wrote: > How can we iterate over a variadic and have it's index. I'll do > different things depend on if it's an even or odd index, but seems to > be no way to get it. Easy: auto func(Args...)(Args args) {

Re: iterate over variadic

2017-07-10 Thread ag0aep6g via Digitalmars-d-learn
On 07/10/2017 08:31 PM, H. S. Teoh via Digitalmars-d-learn wrote: if (i % 2) { // even odd ... // do something with arg } else { // odd even

Cannot dup an associative array but why?

2017-07-10 Thread Jean-Louis Leroy via Digitalmars-d-learn
Is there something special about ClassInfo that confuses? Look at this example: struct Foo { } class Bar { } void main() { Foo*[Bar] a; auto aa = a.dup; // OK Foo*[ClassInfo] b; // Error: static assert "cannot call Foo*[TypeInfo_Class].dup because Foo* is not copyable" auto bb = b.d

Re: Cannot dup an associative array but why?

2017-07-10 Thread Ali Çehreli via Digitalmars-d-learn
On 07/10/2017 11:46 AM, Jean-Louis Leroy wrote: > Is there something special about ClassInfo that confuses? Look at this > example: > > struct Foo > { > > } > > class Bar > { > } > > void main() > { > Foo*[Bar] a; > auto aa = a.dup; // OK > Foo*[ClassInfo] b; // Error: static assert "cannot

Why no offsetof for static struct?

2017-07-10 Thread FoxyBrown via Digitalmars-d-learn
Cannot get the offset of static members of a struct struct X { __gshared public: int x; } X.x.offsetof < invalid. We can clearly get a pointer to the static struct X since &X.x is effectively the address of X(regardless nomenclature and terminology issues in D trying to hide this

Foreign threads in D code.

2017-07-10 Thread Igor Shirkalin via Digitalmars-d-learn
Hello! I have written some D code that I need to link to :C++ huge project. Let it be just one function that uses GC. The question is: if C++ code creates several threads and runs this :D function simultaneously, will GC work correctly? p.s. Of course the druntime is initialized before it.

Re: Why no offsetof for static struct?

2017-07-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 10 July 2017 at 20:01:39 UTC, FoxyBrown wrote: Cannot get the offset of static members of a struct That's because static members do not have an offset. They are not part of the struct in memory, just in name. We can clearly get a pointer to the static struct X There's barely an

Why no offsetof for static struct?

2017-07-10 Thread FoxyBrown via Digitalmars-d-learn
Cannot get the offset of static members of a struct struct X { __gshared public: int x; } X.x.offsetof < invalid. We can clearly get a pointer to the static struct X since &X.x is effectively the address of X(regardless nomenclature and terminology issues in D trying to hide this

Re: Having a strange issue with std.net.curl.HTTP as a struct dependency

2017-07-10 Thread NoBigDeal256 via Digitalmars-d-learn
Still haven't figured out what's wrong. Any help would be appreciated.

Re: Having a strange issue with std.net.curl.HTTP as a struct dependency

2017-07-10 Thread ketmar via Digitalmars-d-learn
NoBigDeal256 wrote: I'm currently learning D and started working on one of my first projects which is an API wrapper. I'm currently having an issue with my program getting a InvalidMemoryOperationError upon exiting the process on Windows 7. On my Debian VM I get a segmentation fault. known b

Re: Having a strange issue with std.net.curl.HTTP as a struct dependency

2017-07-10 Thread NoBigDeal256 via Digitalmars-d-learn
On Monday, 10 July 2017 at 20:31:12 UTC, ketmar wrote: NoBigDeal256 wrote: I'm currently learning D and started working on one of my first projects which is an API wrapper. I'm currently having an issue with my program getting a InvalidMemoryOperationError upon exiting the process on Windows

Re: Having a strange issue with std.net.curl.HTTP as a struct dependency

2017-07-10 Thread ketmar via Digitalmars-d-learn
NoBigDeal256 wrote: Do you happen to have a link to the bug report for this specific issue that I could look at? I looked at the known bugs list and couldn't find anything related to this. nope. it is a kind of "known bug nobody bothered to report". ;-)

Re: Why no offsetof for static struct?

2017-07-10 Thread FoxyBrown via Digitalmars-d-learn
On Monday, 10 July 2017 at 20:13:46 UTC, Adam D. Ruppe wrote: On Monday, 10 July 2017 at 20:01:39 UTC, FoxyBrown wrote: Cannot get the offset of static members of a struct That's because static members do not have an offset. They are not part of the struct in memory, just in name. We can c

Re: Why no offsetof for static struct?

2017-07-10 Thread Ali Çehreli via Digitalmars-d-learn
On 07/10/2017 02:14 PM, FoxyBrown wrote: > On Monday, 10 July 2017 at 20:13:46 UTC, Adam D. Ruppe wrote: >> On Monday, 10 July 2017 at 20:01:39 UTC, FoxyBrown wrote: >>> Cannot get the offset of static members of a struct >> >> That's because static members do not have an offset. They are not part

Re: Cannot dup an associative array but why?

2017-07-10 Thread Jean-Louis Leroy via Digitalmars-d-learn
On Monday, 10 July 2017 at 19:11:37 UTC, Ali Çehreli wrote: On 07/10/2017 11:46 AM, Jean-Louis Leroy wrote: > Is there something special about ClassInfo that confuses? Look at this > example: > > struct Foo > { > > } > > class Bar > { > } > > void main() > { > Foo*[Bar] a; > auto aa = a.dup;

stacktrace for InvalidMemoryOperationError

2017-07-10 Thread crimaniak via Digitalmars-d-learn
Hi! I have vibe.d application and long-standing error in it. For the current moment, I have logs for stdout, stderr, and additional log to write exceptions I catch. This error gives me only the short line in stderr log: core.exception.InvalidMemoryOperationError@src/core/exception.d(696): Inv

Re: Debugging D applications from VS code with webfreak.debug

2017-07-10 Thread Domain via Digitalmars-d-learn
On Friday, 24 February 2017 at 13:19:53 UTC, FR wrote: On Friday, 24 February 2017 at 03:15:11 UTC, Jerry wrote: You can use the C++ plugin, which provides a debugger. Just make sure you aren't using optlink, I don't think it generates compatible files. Also you might need to use "-gc" which g

Re: Why no offsetof for static struct?

2017-07-10 Thread Mike Parker via Digitalmars-d-learn
On 7/11/2017 6:14 AM, FoxyBrown wrote: On Monday, 10 July 2017 at 20:13:46 UTC, Adam D. Ruppe wrote: No, it isn't. Static members are stored in an entirely different place than non-static members. They are really just global variables in memory with their in-source name being nested somewhere

Re: Fiber based UI-Toolkit

2017-07-10 Thread Gerald via Digitalmars-d-learn
On Monday, 10 July 2017 at 14:03:59 UTC, Jacob Carlborg wrote: On 2017-07-10 15:37, Gerald wrote: Having said that, I'm in the camp where this doesn't make much sense. Using fibers on the main UI thread is likely going to result in a blocked UI whenever a fiber takes too long to do its work.

Re: Fiber based UI-Toolkit

2017-07-10 Thread bauss via Digitalmars-d-learn
On Monday, 10 July 2017 at 08:40:15 UTC, Jacob Carlborg wrote: On 2017-07-09 23:12, bauss wrote: I believe OSX (possibly macOS too.) only allows it from the main thread. Yes, that's correct. But what's the difference between OSX and macOS ;) Well besides that it's newer versions of the OS,

Re: Foreign threads in D code.

2017-07-10 Thread Biotronic via Digitalmars-d-learn
On Monday, 10 July 2017 at 20:03:32 UTC, Igor Shirkalin wrote: Hello! I have written some D code that I need to link to :C++ huge project. Let it be just one function that uses GC. The question is: if C++ code creates several threads and runs this :D function simultaneously, will GC work corr

Re: Fiber based UI-Toolkit

2017-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-11 04:40, Gerald wrote: Thanks for the link, I'm not active with .Net so I had to go look it up. Reminds me a lot of the way node.js works. If all your async activity is IO bound maybe it works fine and I'm wrong about this. My past experience has been that it's challenging to det