Spell checking errors can be hilarious
Andrew Edwards
edwards.ac at gmail.com
Tue Oct 13 09:22:14 UTC 2020
On Tuesday, 13 October 2020 at 08:31:34 UTC, Jacob Carlborg wrote:
> On Monday, 12 October 2020 at 20:46:07 UTC, Steven
> Schveighoffer wrote:
>
> auto too(T, U)(U value)
> {
> return value;
> }
>
> void main()
> {
> auto a = 3.to!string;
> }
>
> This will result in a compile error:
>
> Error: no property `to` for type `int`, perhaps `import
> std.conv;` is needed?
>
> Obviously I meant to call the function `too` in the same
> module. Not `std.conv.to`.
>
By revisiting the line of offending code, it would be immediately
apparent as to what was intended—assuming, of course, that the
person encountering the error is, in fact, the author of the
code. The suggestion, therefore, is not entirely useless. I can
easily infer from it what needs to be corrected. What would
improve the situation is providing context along with the error
message:
Error: no property `to` for type `int`, perhaps `import
std.conv;` is needed?
auto a = 3.to!string;
^--------
More information about the Digitalmars-d
mailing list