On Monday, 29 March 2021 at 11:53:32 UTC, Adam D. Ruppe wrote:
On Monday, 29 March 2021 at 02:12:57 UTC, Brad wrote:
[...]

You can still import std.stdio and use other functions with just the one overridden.

D handles name lookups by just ... well, looking up lol. It starts in the current scope, then checks the next one up until the module, then starts looking at imported modules for the name.

If there's two with the same name, it prefers the most local one, but you can override that by using the full name:

import std.stdio;
void writeln() {}

writeln(); // since you have a local name, it uses that first
getc(); // no local name, so it checks the imported modules
std.stdio.writeln(); // specifically uses the one from the module

Perfect.  Thank you Adam.

Reply via email to