Re: Filling an array

2016-03-13 Thread user42 via Digitalmars-d-learn
On Saturday, 12 March 2016 at 18:33:16 UTC, Alex wrote: On Saturday, 12 March 2016 at 16:37:25 UTC, user42 wrote: On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote: /snip I thought this was supposed to halt with an error rather than compile and set all members to 1. The syntax, to me

Re: Filling an array

2016-03-12 Thread user42 via Digitalmars-d-learn
On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote: /snip I thought this was supposed to halt with an error rather than compile and set all members to 1. The syntax, to me anyways, doesn't really communicate the intention of: set all members to 1. //arr[] = 1; Whereas the

Re: Why is it not possible to write to a file from a const member function ?

2016-03-12 Thread user42 via Digitalmars-d-learn
On Saturday, 12 March 2016 at 15:32:39 UTC, Mike Parker wrote: On Saturday, 12 March 2016 at 14:02:31 UTC, user42 wrote: Why is this thing not compiling ? Or, in other words, how is is possible to log something to a file from a const member function ? Const member functions functions are

Why is it not possible to write to a file from a const member function ?

2016-03-12 Thread user42 via Digitalmars-d-learn
Hi I have the following snippet to illustrate my problem/question: class X { import std.stdio: write, File, stdout; private File* f = void p(string s) const { f.write(s); } } class Y { private string s = "Y"; override string toString() const { return s; } }