Re: Printing an std.container.Array

2015-04-17 Thread Daniel Kozák via Digitalmars-d-learn
On Thu, 16 Apr 2015 20:18:40 + Panke via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Yep, but problem is almost no one expect this, or know this. We definitely should do better. How? Improve doc at least. But it would be fine to have something like dump function

Re: Printing an std.container.Array

2015-04-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/16/15 5:18 PM, Dennis Ritchie wrote: On Thursday, 16 April 2015 at 20:34:19 UTC, Steven Schveighoffer wrote: On 4/16/15 4:18 PM, Panke wrote: Yep, but problem is almost no one expect this, or know this. We definitely should do better. How? By doing what is expected. Print the array

Re: Printing an std.container.Array

2015-04-17 Thread Bayan Rafeh via Digitalmars-d-learn
On Thursday, 16 April 2015 at 20:08:30 UTC, H. S. Teoh wrote: On Thu, Apr 16, 2015 at 07:55:52PM +, Bayan Rafeh via Digitalmars-d-learn wrote: Executing this code: import std.container.array; import std.stdio; int main() { writeln(Array!int([1, 2])); return 0; } outputs

Re: Printing an std.container.Array

2015-04-16 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 16 April 2015 at 20:34:19 UTC, Steven Schveighoffer wrote: On 4/16/15 4:18 PM, Panke wrote: Yep, but problem is almost no one expect this, or know this. We definitely should do better. How? By doing what is expected. Print the array contents. See my new comment in that PR.

Re: Printing an std.container.Array

2015-04-16 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, 16 Apr 2015 19:55:52 + Bayan Rafeh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Executing this code: import std.container.array; import std.stdio; int main() { writeln(Array!int([1, 2])); return 0; } outputs the following:

Re: Printing an std.container.Array

2015-04-16 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, 16 Apr 2015 13:05:48 -0700 H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Thu, Apr 16, 2015 at 07:55:52PM +, Bayan Rafeh via Digitalmars-d-learn wrote: Executing this code: import std.container.array; import std.stdio; int main() {

Re: Printing an std.container.Array

2015-04-16 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Apr 16, 2015 at 07:55:52PM +, Bayan Rafeh via Digitalmars-d-learn wrote: Executing this code: import std.container.array; import std.stdio; int main() { writeln(Array!int([1, 2])); return 0; } outputs the following: Array!int(RefCounted!(Payload,

Printing an std.container.Array

2015-04-16 Thread Bayan Rafeh via Digitalmars-d-learn
Executing this code: import std.container.array; import std.stdio; int main() { writeln(Array!int([1, 2])); return 0; } outputs the following: Array!int(RefCounted!(Payload, cast(RefCountedAutoInitialize)0)(RefCountedStore(B694B0))) The strange thing is that this works

Re: Printing an std.container.Array

2015-04-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/16/15 4:18 PM, Panke wrote: Yep, but problem is almost no one expect this, or know this. We definitely should do better. How? By doing what is expected. Print the array contents. See my new comment in that PR. -Steve

Re: Printing an std.container.Array

2015-04-16 Thread Panke via Digitalmars-d-learn
On Thursday, 16 April 2015 at 19:55:53 UTC, Bayan Rafeh wrote: How am I supposed to interpret this? The array contains two elements. The first equals one and the second equals two. What happens under the hood is that Array does no provide a toString method, instead a default is used. This

Re: Printing an std.container.Array

2015-04-16 Thread Panke via Digitalmars-d-learn
Yep, but problem is almost no one expect this, or know this. We definitely should do better. How?