name guess by the compiler

Simen kjaeraas simen.kjaras at gmail.com
Thu Nov 25 02:52:44 PST 2010


On Thu, 25 Nov 2010 11:10:29 +0100, spir <denis.spir at gmail.com> wrote:

> PS: for got to ask: is there any kind of namespace in D -- especially  
> one kind usable for module export?

D does not have namespaces per se. However, modules introduce a sort of
namespace, templates create parametrized namespaces, and final abstract
classes may be used to fake namespaces, should the other features not
be sufficient:

final abstract class MyNamespace {
     static:
         // stuffs
}


> I have no idea how dmd guesses possible names. But surely there is a  
> kind of probability evaluation used to rank possible guesses. If I'm  
> right, then dmd should not output its best guess in every case, but only  
> when its probability value is higher than a given threshold (to be  
> carefully defines).

This sounds reasonable, but hardly top of the list on urgency.


> Also, the case above probably reveals some kind of bug, since it is hard  
> to imagine how "to" can ever be the best guess for "i" (and there is no  
> alias in the test case). PS: "alias to" is only guessed when the module  
> imports std.conv:to. Still, how to guess "to" from "i"? Finally, should  
> the guessing feature exclude (unqualfied) imported symbols?

Absolutely not.

-- 
Simen


More information about the Digitalmars-d mailing list