Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-10 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 21:16:08 UTC, ag0aep6g wrote: On Saturday, 9 April 2016 at 19:31:31 UTC, Uranuz wrote: I think that we need to add warning about such case in documentation section: https://dlang.org/spec/hash-map.html#construction_and_ref_semantic in order to prevent this kind of

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 9 April 2016 at 19:31:31 UTC, Uranuz wrote: I think that we need to add warning about such case in documentation section: https://dlang.org/spec/hash-map.html#construction_and_ref_semantic in order to prevent this kind of mistakes in code. Isn't that exactly what the section you

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 9 April 2016 at 19:25:32 UTC, Uranuz wrote: Another observation is illustrated with the foloving code: http://dpaste.dzfl.pl/8d68fd5922b7 Because AA and arrays are not created before they were assigned some value it leads to inconsistency in behavior. And will produce unexpected

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 19:25:32 UTC, Uranuz wrote: On Saturday, 9 April 2016 at 18:27:11 UTC, ag0aep6g wrote: [...] Another observation is illustrated with the foloving code: http://dpaste.dzfl.pl/8d68fd5922b7 Because AA and arrays are not created before they were assigned some value

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 18:27:11 UTC, ag0aep6g wrote: On Saturday, 9 April 2016 at 18:06:52 UTC, Uranuz wrote: Thanks. It's clear now. AA holds not `array struct` itself inside, but pointer to it. How the array is stored in the AA doesn't matter, as far as I can see. The point is that

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 9 April 2016 at 18:06:52 UTC, Uranuz wrote: Thanks. It's clear now. AA holds not `array struct` itself inside, but pointer to it. How the array is stored in the AA doesn't matter, as far as I can see. The point is that you obtain a pointer to the array struct in the AA, not a

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 16:44:06 UTC, ag0aep6g wrote: On 09.04.2016 18:13, Uranuz wrote: http://dpaste.dzfl.pl/523781df67ab For reference, the code: import std.stdio; void main() { string[][string] mapka; string[]* mapElem = "item" in mapka; //Checking if I

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On 09.04.2016 18:13, Uranuz wrote: http://dpaste.dzfl.pl/523781df67ab For reference, the code: import std.stdio; void main() { string[][string] mapka; string[]* mapElem = "item" in mapka; //Checking if I have item if( !mapElem )

Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
I am stupid today :) So I have a question. The piece of code given: http://dpaste.dzfl.pl/523781df67ab It looks good, but I don't understand why it works?