Spell checking errors can be hilarious

Steven Schveighoffer schveiguy at gmail.com
Mon Oct 12 18:17:52 UTC 2020


On 10/12/20 1:33 PM, Q. Schroll wrote:
> On Monday, 12 October 2020 at 17:04:01 UTC, Ali Çehreli wrote:
>> The unfortunate thing in the video was 'to' is not searchable on the 
>> internet
> 
> It's not even searchable on the DLang site (e.g. using site:dlang.org on 
> DuckDuckGo); we should avoid these names. Renaming `to` to `convertTo` 
> would solve that using
> 
>      import std.conv : to = convertTo;
> 
> when using it. It costs a few keystrokes tho.

No, I think this isn't what we need.

I'm watching the video and one key problem they are having is they are 
not putting dlang on all their searches. D is much less represented on 
the Internet than it should be. If I search for dlang "template instance 
to!string template to is not defined", the top result's title is "Errors 
of missing `std.conv` imports"

But what I think we need to do is formalize and make extendable the 
awesome feature of the compiler to suggest imports.

For example, if you do:

void main()
{
   writeln("hello world!");
}

It will complain:

Error: writeln is not defined, perhaps import std.stdio; is needed?

As I understand it, these functions to import mappings are hard coded in 
the compiler. Can we make it not hard coded? And then mere mortals (and 
not compiler developers) can add these to the list as we notice they 
should be? Perhaps even someone can write an extractor that generates 
the mappings for a given library.

This would be huge for newcomers, especially with stuff like this all 
over our tutorial pages.

-Steve


More information about the Digitalmars-d mailing list