Re: Questions about dmd source

2017-07-30 Thread ketmar via Digitalmars-d-learn
Francis Nixon wrote: I have two completely unrelated questions about the dmd source code. 1. What does the mtype.Type.dotExp method do? The documentation comment says that it "Accesses the members of the object e". I'm not sure exactly why I would want to do that? Is it for handling types

GC

2017-07-30 Thread piotrekg2 via Digitalmars-d-learn
I would like to learn more about GC in D. For example can anyone explain why do we need memset(0) here: https://github.com/dlang/phobos/blob/master/std/container/array.d#L356 , doesn't it assume a certain type of GC? What if there is a need to change the GC algorithm in the future? It would be

Static array * scalar is not working for me

2017-07-30 Thread Danni Coy via Digitalmars-d-learn
The following code is not working for me float[3] f; f[] = abs(f)[] * -1.0f; where abs is a function that returns a float[3]; it complains that f should be attached to some memory. Is it a bug or am I missing something?

Re: GC

2017-07-30 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 30 July 2017 at 09:12:53 UTC, piotrekg2 wrote: I would like to learn more about GC in D. For example can anyone explain why do we need memset(0) here: https://github.com/dlang/phobos/blob/master/std/container/array.d#L356 , doesn't it assume a certain type of GC? What if there is a

Re: GC

2017-07-30 Thread Moritz Maxeiner via Digitalmars-d-learn
On Sunday, 30 July 2017 at 09:12:53 UTC, piotrekg2 wrote: I would like to learn more about GC in D. [...] It would be great if you could point me out to articles on this subject. The primary locations to get information are the language specification [1] and the druntime documentation [2]. I

Re: GC

2017-07-30 Thread rikki cattermole via Digitalmars-d-learn
On 30/07/2017 10:12 AM, piotrekg2 wrote: I would like to learn more about GC in D. For example can anyone explain why do we need memset(0) here: https://github.com/dlang/phobos/blob/master/std/container/array.d#L356 , doesn't it assume a certain type of GC? What if there is a need to change

Re: Static array * scalar is not working for me

2017-07-30 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 30 July 2017 at 08:18:07 UTC, Danni Coy wrote: The following code is not working for me float[3] f; f[] = abs(f)[] * -1.0f; where abs is a function that returns a float[3]; it complains that f should be attached to some memory. Is it a bug or am I missing something? I cannot

Re: Static array * scalar is not working for me

2017-07-30 Thread Temtaime via Digitalmars-d-learn
On Sunday, 30 July 2017 at 08:18:07 UTC, Danni Coy wrote: The following code is not working for me float[3] f; f[] = abs(f)[] * -1.0f; where abs is a function that returns a float[3]; it complains that f should be attached to some memory. Is it a bug or am I missing something? This is

Re: Questions about dmd source

2017-07-30 Thread Anton Fediushin via Digitalmars-d-learn
On Sunday, 30 July 2017 at 06:18:16 UTC, Francis Nixon wrote: I have two completely unrelated questions about the dmd source code. 2. I've noticed there are some rather long methods in the dmd source, involving more than one goto; parse.d is particularly bad. Is there a reason for this/is it

Re: Struct Postblit Void Initialization

2017-07-30 Thread Eugene Wissner via Digitalmars-d-learn
On Sunday, 30 July 2017 at 19:22:07 UTC, Jiyan wrote: Hey, just wanted to know whether something like this would be possible sowmehow: struct S { int m; int n; this(this) { m = void; n = n; } } So not the whole struct is moved everytime f.e. a function is called, but only n has to be

Re: Is std.xml seriously broken, or is it me?

2017-07-30 Thread Joakim via Digitalmars-d-learn
On Sunday, 30 July 2017 at 03:16:35 UTC, Mike wrote: On Sunday, 30 July 2017 at 02:58:09 UTC, Mike wrote: [...] It appears `onStartTag` does not handle the root element. For example, this code seems to work: import std.xml; import std.stdio; void main() { auto parser = new

Re: D move semantics

2017-07-30 Thread Moritz Maxeiner via Digitalmars-d-learn
On Sunday, 30 July 2017 at 16:12:41 UTC, piotrekg2 wrote: What is the idiomatic D code equivalent to this c++ code? There's no direct equivalent of all your code to D using only druntime+phobos AFAIK. class Block { [...] }; Since you don't seem to be using reference type semantics or

Struct Postblit Void Initialization

2017-07-30 Thread Jiyan via Digitalmars-d-learn
Hey, just wanted to know whether something like this would be possible sowmehow: struct S { int m; int n; this(this) { m = void; n = n; } } So not the whole struct is moved everytime f.e. a function is called, but only n has to be "filled"

Re: Struct Postblit Void Initialization

2017-07-30 Thread Moritz Maxeiner via Digitalmars-d-learn
On Sunday, 30 July 2017 at 19:22:07 UTC, Jiyan wrote: Hey, just wanted to know whether something like this would be possible sowmehow: struct S { int m; int n; this(this) { m = void; n = n; } } So not the whole struct is moved everytime f.e. a function is called, but only n has to be

Re: Struct Postblit Void Initialization

2017-07-30 Thread Jiyan via Digitalmars-d-learn
On Sunday, 30 July 2017 at 19:32:48 UTC, Eugene Wissner wrote: On Sunday, 30 July 2017 at 19:22:07 UTC, Jiyan wrote: Hey, just wanted to know whether something like this would be possible sowmehow: struct S { int m; int n; this(this) { m = void; n = n; } } So not the whole struct is moved

D move semantics

2017-07-30 Thread piotrekg2 via Digitalmars-d-learn
What is the idiomatic D code equivalent to this c++ code? class Block { public: Block() : data_(new char[4096]) {} ... // NOTE: both members marked noexcept Block(Block &) noexcept = default; Block& operator=(Block &) noexcept = default; ... private: std::unique_ptr

Convert ResultSet to List of Associted Array

2017-07-30 Thread Jshah via Digitalmars-d-learn
Hi I am new to D writing a web service with vibe. My webservice connect to mysql and return the result as JSON. How do I convert resultset to Array of Associated Array [["col1" : value, "col2" : value], ]

Re: Convert ResultSet to List of Associted Array

2017-07-30 Thread Jshah via Digitalmars-d-learn
On Sunday, 30 July 2017 at 16:39:05 UTC, Jshah wrote: Hi I am new to D writing a web service with vibe. My webservice connect to mysql and return the result as JSON. How do I convert resultset to Array of Associated Array [["col1" : value, "col2" : value], ] I am using mysql-native