Re: Fiber based UI-Toolkit

2017-07-09 Thread Christian Köstlin via Digitalmars-d-learn
On 10.07.17 00:23, Christian Köstlin wrote: To elaborate on the previous post, I uploaded a small example, that tries naively to mix dlangui with fibers. Please have a look at: https://github.com/gizmomogwai/fibered-ui.git For sure it does not work. The fiber in the callback is started, but after t

Re: How to get the address of a static struct?

2017-07-09 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 10 July 2017 at 03:48:17 UTC, FoxyBrown wrote: static struct S auto s = &S; // ?!?!?! invalid because S is a struct, but... basically s = S. So S.x = s.x and s.a = S.a; Why do I have to do this? Static has a different meaning for struct. More or less it means it won't have acces

Re: How to get the address of a static struct?

2017-07-09 Thread rikki cattermole via Digitalmars-d-learn
Thread local struct: ```D module foobar; struct Foo { int x; } Foo foo = Foo(8); void main() { import std.stdio; writeln(&foo); } ``` Global struct: ```D module foobar; struct Foo { int x; } __gshared Foo foo = Foo(8); void main() { import std.stdio

How to get the address of a static struct?

2017-07-09 Thread FoxyBrown via Digitalmars-d-learn
static struct S { public static: int x; string a; } auto s = &S; // ?!?!?! invalid because S is a struct, but... basically s = S. So S.x = s.x and s.a = S.a; Why do I have to do this? Because in visual D, global structs don't show up in the debugger. So if I crea

Re: Faster alternatives to std.xml

2017-07-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 8, 2017 8:45:57 PM MDT Nordlöw via Digitalmars-d-learn wrote: > What's the fastest XML-parser on code.dlang.org? > > Are there any benchmarks that show performance improvements > compared to std.xml? I'm not aware of any benchmarks for std.xml, but from what I know of it, it wou

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, July 9, 2017 1:51:44 PM MDT kdevel via Digitalmars-d-learn wrote: > > You also shouldn't rely on it returning null for a null input, > > even when it currently does that. > > I assumed that a non-null string is returned for a non-null input. There are going to be functions that return n

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

2017-07-09 Thread NoBigDeal256 via Digitalmars-d-learn
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. I have tried to minimize the

Re: iterate over variadic

2017-07-09 Thread Lamex via Digitalmars-d-learn
On Sunday, 9 July 2017 at 22:21:59 UTC, FoxyBrown 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. import std.stdio; import std.typecons, std.meta; template indexedAllSatisfy(alia

Re: iterate over variadic

2017-07-09 Thread drug via Digitalmars-d-learn
10.07.2017 01:21, FoxyBrown пишет: 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. auto foo(Types...)() { foreach(T; Types) { // do what you need

Re: Lazy range, extract only Nth element, set range size constraint?

2017-07-09 Thread ag0aep6g via Digitalmars-d-learn
On 07/09/2017 11:51 PM, biocyberman wrote: Following is the code for a more generalized Fibonacci range. Questions: 1. How do I get only the value of the Nth (i.e. N = 25) element in an idiomatic way? As you've only got an input range, you have to popFront the 24 values that come before. Yo

Re: Fiber based UI-Toolkit

2017-07-09 Thread Christian Köstlin via Digitalmars-d-learn
On 09.07.17 23:12, bauss 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? >> >> christian > > It doesn't r

iterate over variadic

2017-07-09 Thread FoxyBrown via Digitalmars-d-learn
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.

Lazy range, extract only Nth element, set range size constraint?

2017-07-09 Thread biocyberman via Digitalmars-d-learn
Following is the code for a more generalized Fibonacci range. Questions: 1. How do I get only the value of the Nth (i.e. N = 25) element in an idiomatic way? 2. Can I set constraints in the range so that user gets warning if he asks for Nth element greater than a limit, say N> 30; or if the

Re: Fiber based UI-Toolkit

2017-07-09 Thread Meta via Digitalmars-d-learn
On Sunday, 9 July 2017 at 21:12:24 UTC, bauss 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? christian It do

Re: Fiber based UI-Toolkit

2017-07-09 Thread bauss 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? christian It doesn't really make sense to have that, because most (if

Fiber based UI-Toolkit

2017-07-09 Thread Christian Köstlin via Digitalmars-d-learn
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? christian

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread ag0aep6g via Digitalmars-d-learn
On Sunday, 9 July 2017 at 18:55:51 UTC, kdevel wrote: Yes, it can obviously return one of the two representations of the empty D string. The two being null and ""? There are more than those. One for every possible .ptr value.

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread kdevel via Digitalmars-d-learn
On Sunday, 9 July 2017 at 15:10:56 UTC, ag0aep6g wrote: On 07/09/2017 03:51 PM, kdevel wrote: On Sunday, 9 July 2017 at 10:32:23 UTC, ag0aep6g wrote: [...] A null char* is not a proper C string. A C string is a sequence of storage units containing legitimate character values of which the

Re: NNTP error: Disconnected from server (Connection closed)

2017-07-09 Thread Ali Çehreli via Digitalmars-d-learn
On 07/09/2017 06:10 AM, kdevel wrote: What's going on here? Happens all the time. Last time (I think) Martin Nowak had said that a network packet trace would be helpful to debug this issue. Ali

Re: CTFE output is kind of weired

2017-07-09 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 9 July 2017 at 08:43:47 UTC, Andre Pany wrote: Thanks for all the answers and explanations. I will create an issue to make the assert output more readable. The first 5 times I didn't recognize the slice information at the end of the string and thought dmd isn't working at all anymo

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread ag0aep6g via Digitalmars-d-learn
On 07/09/2017 03:51 PM, kdevel wrote: On Sunday, 9 July 2017 at 10:32:23 UTC, ag0aep6g wrote: [...] As mentioned in the subject my posting is about the state of affairs wrt. the (non-)nullity of strings. In C/C++ once a char * variable became non-NULL 'it' never loses this property. In D this

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread kdevel via Digitalmars-d-learn
On Sunday, 9 July 2017 at 13:51:44 UTC, kdevel wrote: But that second proposition what not the one chosen in the documentation. Shall read: "But that second predicate was not the one chosen in the documentation."

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread kdevel via Digitalmars-d-learn
On Sunday, 9 July 2017 at 10:32:23 UTC, ag0aep6g wrote: On 07/09/2017 01:12 AM, kdevel wrote: On Saturday, 8 July 2017 at 18:39:47 UTC, ag0aep6g wrote: On 07/08/2017 07:16 PM, kdevel wrote: [...] Moreover everything I've written about strings is also valid for e.g. dynamic arrays of doubles

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread kdevel via Digitalmars-d-learn
On Saturday, 8 July 2017 at 23:12:15 UTC, Jonathan M Davis wrote: On Saturday, July 8, 2017 5:16:51 PM MDT kdevel via Digitalmars-d-learn wrote: [...] IMHO, if you want to check for empty, then you should use the empty property or check length directly, since those are clear about your inten

NNTP error: Disconnected from server (Connection closed)

2017-07-09 Thread kdevel via Digitalmars-d-learn
What's going on here?

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread ag0aep6g via Digitalmars-d-learn
On 07/09/2017 01:12 AM, kdevel wrote: On Saturday, 8 July 2017 at 18:39:47 UTC, ag0aep6g wrote: On 07/08/2017 07:16 PM, kdevel wrote: null is one specific array. It happens to be empty, but that doesn't really matter. `foo is null` compares with the null array. It doesn't check for emptiness

Is runtime info in shared memory?

2017-07-09 Thread Jean-Louis Leroy via Digitalmars-d-learn
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'.

Re: CTFE output is kind of weired

2017-07-09 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 9 July 2017 at 06:48:30 UTC, Stefan Koch wrote: On Sunday, 9 July 2017 at 04:03:09 UTC, H. S. Teoh wrote: On Sat, Jul 08, 2017 at 03:09:09PM -0700, Ali Çehreli via Digitalmars-d-learn wrote: On 07/08/2017 02:29 PM, Andre Pany wrote: > I use assert(false, tmp) to see the content of v