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

Steven Schveighoffer schveiguy at yahoo.com
Mon May 21 17:43:44 UTC 2018


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/ 
> 
> 
> Reddit:
> https://www.reddit.com/r/programming/comments/8l1a8u/prefer_alias_this_over_alias_for_easiertoread/ 
> 

The list has two "1." headers.

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 better when you pass it into something that only accepts the aliased 
type. However, for the most part, these are non-template functions anyway.

-Steve


More information about the Digitalmars-d-announce mailing list