Re: Assoc. Array and struct with immutable member

2018-04-15 Thread Alex via Digitalmars-d-learn
On Sunday, 15 April 2018 at 17:59:01 UTC, Dgame wrote: How am I supposed to insert a struct with immutable members into an assoc. array? Reduced example: struct A { immutable string name; } A[string] as; as["a"] = A("a"); // Does not work Via a static this() it would work. But

Assoc. Array and struct with immutable member

2018-04-15 Thread Dgame via Digitalmars-d-learn
How am I supposed to insert a struct with immutable members into an assoc. array? Reduced example: struct A { immutable string name; } A[string] as; as["a"] = A("a"); // Does not work

Re: Why is the error message coming by the end of the compilation?

2018-04-15 Thread bauss via Digitalmars-d-learn
On Sunday, 15 April 2018 at 16:55:36 UTC, bauss wrote: On Sunday, 15 April 2018 at 15:55:15 UTC, ag0aep6g wrote: On 04/15/2018 05:33 PM, bauss wrote: On Sunday, 15 April 2018 at 10:27:26 UTC, ag0aep6g wrote: On 04/14/2018 08:56 PM, bauss wrote: I wish there was a way to give a mixin some kind

Re: Why is the error message coming by the end of the compilation?

2018-04-15 Thread bauss via Digitalmars-d-learn
On Sunday, 15 April 2018 at 15:55:15 UTC, ag0aep6g wrote: On 04/15/2018 05:33 PM, bauss wrote: On Sunday, 15 April 2018 at 10:27:26 UTC, ag0aep6g wrote: On 04/14/2018 08:56 PM, bauss wrote: I wish there was a way to give a mixin some kind of identity like: mixin("mymixin", "somecode");

Re: Why is the error message coming by the end of the compilation?

2018-04-15 Thread ag0aep6g via Digitalmars-d-learn
On 04/15/2018 05:33 PM, bauss wrote: On Sunday, 15 April 2018 at 10:27:26 UTC, ag0aep6g wrote: On 04/14/2018 08:56 PM, bauss wrote: I wish there was a way to give a mixin some kind of identity like: mixin("mymixin", "somecode"); Where an error message would print something like: Error in

Re: Why is the error message coming by the end of the compilation?

2018-04-15 Thread bauss via Digitalmars-d-learn
On Sunday, 15 April 2018 at 10:14:56 UTC, Simen Kjærås wrote: On Saturday, 14 April 2018 at 08:20:51 UTC, bauss wrote: The problem is I can't pragma(msg) the code I want to mixin manually since all mixins are dynamically generated. That's why my only way is to do it within that static foreach.

Re: "%s"-format template function arguments

2018-04-15 Thread ag0aep6g via Digitalmars-d-learn
On 04/15/2018 02:04 PM, vladdeSV wrote:     foo(1,2,3);     void foo(T...)(T args)     {     writefln("expected: %s", [1,2,3]);     writefln("actual: %s", args);     } The code above will output     expected: [1, 2, 3]     actual: 1 How would I go on about to print all the

Re: "%s"-format template function arguments

2018-04-15 Thread Dennis via Digitalmars-d-learn
On Sunday, 15 April 2018 at 12:04:19 UTC, vladdeSV wrote: How would I go on about to print all the arguments as I expected it, using "%s"? You can expand the template arguments into an array by putting it into square brackets: [args]. You can format an array with the default notation using

Re: "%s"-format template function arguments

2018-04-15 Thread Alex via Digitalmars-d-learn
On Sunday, 15 April 2018 at 12:04:19 UTC, vladdeSV wrote: Hello people of D-land. In a template function, I want to format all arguments as if it was an array. Se this snippet of code: foo(1,2,3); void foo(T...)(T args) { writefln("expected: %s", [1,2,3]);

"%s"-format template function arguments

2018-04-15 Thread vladdeSV via Digitalmars-d-learn
Hello people of D-land. In a template function, I want to format all arguments as if it was an array. Se this snippet of code: foo(1,2,3); void foo(T...)(T args) { writefln("expected: %s", [1,2,3]); writefln("actual: %s", args); } The code above will output

Re: Why is the error message coming by the end of the compilation?

2018-04-15 Thread ag0aep6g via Digitalmars-d-learn
On 04/14/2018 08:56 PM, bauss wrote: I wish there was a way to give a mixin some kind of identity like: mixin("mymixin", "somecode"); Where an error message would print something like: Error in mixin("mymixin"): ... That would completely solve this issue and I wouldn't have to have

Re: Why is the error message coming by the end of the compilation?

2018-04-15 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 14 April 2018 at 08:20:51 UTC, bauss wrote: The problem is I can't pragma(msg) the code I want to mixin manually since all mixins are dynamically generated. That's why my only way is to do it within that static foreach. Wat. So the compiler is able to generate the string you

Re: How/where to hack DMD to generate docs for string mixed members.

2018-04-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, April 15, 2018 07:59:17 Stefan Koch via Digitalmars-d-learn wrote: > On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote: > > Hey, > > > > How/where to hack DMD to generate docs for string mixed members? > > > > struct S > > { > > > > mixin(" > > > > /// > > auto bar() {}

Re: How/where to hack DMD to generate docs for string mixed members.

2018-04-15 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote: Hey, How/where to hack DMD to generate docs for string mixed members? struct S { mixin(" /// auto bar() {} "); } Best regards, Ilya Yaroshenko hmm you should be able to see docs for string mixins, if not. try using