Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Mike Parker via Digitalmars-d-announce
On Monday, 21 May 2018 at 20:22:05 UTC, Nick Sabalausky (Abscissa) wrote: On 05/21/2018 12:36 PM, Arredondo wrote: > One typo: > >> 1. Although the alias this means MyType... >> 2. Although the alias this means MyType... Sheesh. I stared at this for a bit, thinkking, "But that's the same

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d-announce
On 5/21/18 4:29 PM, Nick Sabalausky (Abscissa) wrote: On 05/21/2018 01:30 PM, Paul Backus wrote: I'm not sure making `_data` private is really a good idea. For example, this only works if `_data` is public: import std.algorithm; import std.range; import std.stdio; struct MyType {  auto

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-announce
On 05/21/2018 01:43 PM, Steven Schveighoffer wrote: Nice idea, I wonder if the compiler couldn't do this automatically with alias, however. It already does this in some cases (e.g. string instead of immutable(char)[]). This would help solve the problem that error messages aren't going to get

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-announce
On 05/21/2018 01:30 PM, Paul Backus wrote: I'm not sure making `_data` private is really a good idea. For example, this only works if `_data` is public: import std.algorithm; import std.range; import std.stdio; struct MyType { auto _data = iota(10); alias _data this; } void

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-announce
On 05/21/2018 12:36 PM, Arredondo wrote: > One typo: > >> 1. Although the alias this means MyType... >> 2. Although the alias this means MyType... On 05/21/2018 01:43 PM, Steven Schveighoffer wrote: > The list has two "1." headers. Looks like the blog software got confused by my multi-paragraph

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d-announce
On 5/21/18 10:48 AM, Mike Parker wrote: Nick Sabaluasky's first post to the D Blog is a tip on how to create an aliased type that keeps its name in error messages. The blog: https://dlang.org/blog/2018/05/21/complicated-types-prefer-alias-this-over-alias-for-easier-to-read-error-messages/

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Paul Backus via Digitalmars-d-announce
On Monday, 21 May 2018 at 14:48:23 UTC, Mike Parker wrote: Nick Sabaluasky's first post to the D Blog is a tip on how to create an aliased type that keeps its name in error messages. I'm not sure making `_data` private is really a good idea. For example, this only works if `_data` is public:

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Simen Kjærås via Digitalmars-d-announce
On Monday, 21 May 2018 at 14:48:23 UTC, Mike Parker wrote: Nick Sabaluasky's first post to the D Blog is a tip on how to create an aliased type that keeps its name in error messages. Nice. Interestingly, the error message references the wrong type when trying to access static members:

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Arredondo via Digitalmars-d-announce
Nice tip! One typo: 1. Although the alias this means MyType... should be 2. Although the alias this means MyType... Arredondo.

Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Mike Parker via Digitalmars-d-announce
Nick Sabaluasky's first post to the D Blog is a tip on how to create an aliased type that keeps its name in error messages. The blog: https://dlang.org/blog/2018/05/21/complicated-types-prefer-alias-this-over-alias-for-easier-to-read-error-messages/ Reddit: