[Issue 5004] show both resolved symbols and original identifier in error messages involving aliases

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 15 14:43:35 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5004


Denis Derman <denis.spir at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |denis.spir at gmail.com


--- Comment #4 from Denis Derman <denis.spir at gmail.com> 2011-02-15 14:40:59 PST ---
(In reply to comment #0)
> The Clang front-end of LLVM tries harder to give good error messages:
> http://clang.llvm.org/diagnostics.html
> 
> One simple but nice feature of its error messages is the usage of "aka", this
> is an example:
> 
> t.c:13:9: error: member reference base type 'pid_t' (aka 'int') is not a
> structure or union
> 
> 
> This is a wrong D2 program: 
> 
> 
> void main() {
>     alias int Foo;
>     Foo f;
>     f = f.x;
> }
> 
> 
> DMD 2.049 prints:
> test.d(4): Error: no property 'x' for type 'int'
> 
> But a more useful error message can be:
> test.d(4): Error: no property 'x' for type 'Foo' (aka 'int')

Agreed, would be very nive. Have no idea at which stage in the "decoding"
sequence name aliases are resoved, which certainly determines the difficulty of
implementing the feature.
Anyway, since D's term is 'alias', this term should be used in error messages
instead of 'aka'. Also, 'aka' can be difficult for non-english speakers (have
learnt it myself only recently, after decades of English practice). 'alias'
does not have this issue due to beeing part of D's terminology. However, it
goes in opposite sense, I guess:

test.d(4): Error: no property 'x' for type 'Foo' (alias for 'int')

Or maybe suppleness of English allows the following to be clear?

test.d(4): Error: no property 'x' for type 'Foo' ('int' alias)

Denis

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list