Re: Getting nice print of struct for debugging

2017-02-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-02-22 12:18, Martin Tschierschke wrote: Exactly what I was looking for, **thank you!** Both ways of accessing the struct elements are very interesting, giving an impression what is possible with D. Is it possible to overwrite "toString" for all structs in one step? It depends. You

Re: template parameter inference and introspection

2017-02-24 Thread John Colvin via Digitalmars-d-learn
On Thursday, 23 February 2017 at 18:33:33 UTC, Meta wrote: On Thursday, 23 February 2017 at 18:21:51 UTC, Meta wrote: On Thursday, 23 February 2017 at 16:01:44 UTC, John Colvin wrote: Is there any way to get a reference/alias to the instantiation of a template function that would be called,

Re: Class Order Style

2017-02-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-02-20 14:47, Jolly James wrote: How to sort the members of a class? like: 1. properties then 2. private 3. methods 4. ctors ... and so on. are there any recommendations? In my opinion: 1. Manifest constants (enum) 2. Static variables 3. Instance variables 4. Constructors 5.

Re: Serializer class

2017-02-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-02-22 20:13, thedeemon wrote: On Wednesday, 22 February 2017 at 18:34:26 UTC, houdoux09 wrote: void Read(T)(T value) { foreach(i, mm; value.tupleof) { writeln(__traits(identifier, value.tupleof[i]), " = ", mm); if(isArray!(typeof(mm))) { Read(mm[0]);

Re: Debugging D applications from VS code with webfreak.debug

2017-02-24 Thread FR via Digitalmars-d-learn
On Friday, 24 February 2017 at 03:15:11 UTC, Jerry wrote: You can use the C++ plugin, which provides a debugger. Just make sure you aren't using optlink, I don't think it generates compatible files. Also you might need to use "-gc" which generates debug names to be in C format.

Re: template parameter inference and introspection

2017-02-24 Thread John Colvin via Digitalmars-d-learn
On Friday, 24 February 2017 at 14:06:22 UTC, Meta wrote: On Friday, 24 February 2017 at 11:17:46 UTC, John Colvin wrote: Unfortunately that only works by accident of my example. A counterexample: T foo(Q = float, T = short)(T t) { return t; } alias Typeof(alias v) = typeof(v); template

Re: template parameter inference and introspection

2017-02-24 Thread Meta via Digitalmars-d-learn
On Friday, 24 February 2017 at 11:17:46 UTC, John Colvin wrote: Unfortunately that only works by accident of my example. A counterexample: T foo(Q = float, T = short)(T t) { return t; } alias Typeof(alias v) = typeof(v); template getInstantiation(alias f, T...) { import std.meta;

Re: Getting nice print of struct for debugging

2017-02-24 Thread Minty Fresh via Digitalmars-d-learn
On Saturday, 25 February 2017 at 01:27:09 UTC, Minty Fresh wrote: On Wednesday, 22 February 2017 at 11:18:15 UTC, Martin Tschierschke wrote: [...] Since structs are Plain-old Data and don't do inheritance, the best option is a template mixin. ie. template mixin PrettyPrint {

Re: Getting nice print of struct for debugging

2017-02-24 Thread Minty Fresh via Digitalmars-d-learn
On Wednesday, 22 February 2017 at 11:18:15 UTC, Martin Tschierschke wrote: On Tuesday, 21 February 2017 at 14:02:54 UTC, Jacob Carlborg wrote: [...] Yes, this works, I would say this is the simplest: MyStruct s; foreach (index, name ; FieldNameTuple!MyStruct) writefln("%s: %s", name,

Re: Recommend: IDE and GUI library

2017-02-24 Thread Moritz Maxeiner via Digitalmars-d-learn
On Friday, 24 February 2017 at 22:44:55 UTC, XavierAP wrote: Hi I've looked at wiki.dlang.org/IDEs, and I see that Visual D is linked from dlang.org/download.html. Still I was looking for personal opinions and experiences beyond hard specs, I wonder if one of the IDEs is already dominant at

Re: Serializer class

2017-02-24 Thread houdoux09 via Digitalmars-d-learn
I'm pretty sure you need to use "value.tupleof[i][0]" instead of "mm[0]" as well. it does not work but I found a solution, that's what I do : abstract class BaseClass { uint[] a = [9, 10, 5]; } override class Test : BaseClass { int t = 0; string s = "holla"; } public static

Re: Recommend: IDE and GUI library

2017-02-24 Thread evilrat via Digitalmars-d-learn
On Saturday, 25 February 2017 at 00:45:24 UTC, Moritz Maxeiner wrote: I use Visual Studio Code on Linux and macOS, not sure how the experience on Windows is, but I'd expect it to be the same. Windows is fine, can also debug mscoff x86 or x64 projects with MS 'cpptools' plugin that has

Recommend: IDE and GUI library

2017-02-24 Thread XavierAP via Digitalmars-d-learn
Hi I've looked at wiki.dlang.org/IDEs, and I see that Visual D is linked from dlang.org/download.html. Still I was looking for personal opinions and experiences beyond hard specs, I wonder if one of the IDEs is already dominant at least for each OS for any good reason. My requirements are