www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Documentation error

reply Flade <consolemaster0 gmail.com> writes:
Hi everyone! I'm new to D (this is my first post hele) and I was 
just reading the documentation from the beginning and I found an 
error. In the part when it's talking about scoped imports, in the 
second code snippet, there is an error when it's says:
<< writeln("bar"); // calls std.stdio.writeln >>

(it's 8th line if you paste it in an editor). This is actually 
calling the writeln function we have made and not the writeln 
function from the std.stdio module. When calling "foo" as it is 
in the example it prints nothing to the terminal which is really 
odd! Replacing this line with:
<< std.stdio.writeln("bar") >>
and running the program, it normally prints "bar" to the terminal 
as expected!

Run it and you'll see!
Aug 04 2020
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 8/4/20 11:05 AM, Flade wrote:
 Hi everyone! I'm new to D (this is my first post hele) and I was just 
 reading the documentation from the beginning and I found an error. In 
 the part when it's talking about scoped imports, in the second code 
 snippet, there is an error when it's says:
 << writeln("bar"); // calls std.stdio.writeln >>
 
 (it's 8th line if you paste it in an editor). This is actually calling 
 the writeln function we have made and not the writeln function from the 
 std.stdio module. When calling "foo" as it is in the example it prints 
 nothing to the terminal which is really odd! Replacing this line with:
 << std.stdio.writeln("bar") >>
 and running the program, it normally prints "bar" to the terminal as 
 expected!
 
 Run it and you'll see!
Can you post a link to the page you are referring to? -Steve
Aug 04 2020
parent reply Petar Kirov [ZombineDev] <petar.p.kirov gmail.com> writes:
On Tuesday, 4 August 2020 at 15:07:58 UTC, Steven Schveighoffer 
wrote:
 On 8/4/20 11:05 AM, Flade wrote:
 [...]
Can you post a link to the page you are referring to? -Steve
I think it's this one: https://dlang.org/spec/module.html#name_lookup
Aug 04 2020
parent reply Petar Kirov [ZombineDev] <petar.p.kirov gmail.com> writes:
On Tuesday, 4 August 2020 at 16:28:31 UTC, Petar Kirov 
[ZombineDev] wrote:
 On Tuesday, 4 August 2020 at 15:07:58 UTC, Steven Schveighoffer 
 wrote:
 On 8/4/20 11:05 AM, Flade wrote:
 [...]
Can you post a link to the page you are referring to? -Steve
I think it's this one: https://dlang.org/spec/module.html#name_lookup
Edit: I meant this one: https://dlang.org/spec/module.html#scoped_imports
Aug 04 2020
next sibling parent Flade <consolemaster0 gmail.com> writes:
On Tuesday, 4 August 2020 at 16:33:32 UTC, Petar Kirov 
[ZombineDev] wrote:
 On Tuesday, 4 August 2020 at 16:28:31 UTC, Petar Kirov 
 [ZombineDev] wrote:
 On Tuesday, 4 August 2020 at 15:07:58 UTC, Steven 
 Schveighoffer wrote:
 On 8/4/20 11:05 AM, Flade wrote:
 [...]
Can you post a link to the page you are referring to? -Steve
I think it's this one: https://dlang.org/spec/module.html#name_lookup
Edit: I meant this one: https://dlang.org/spec/module.html#scoped_imports
Yep exactly! It's this page!
Aug 04 2020
prev sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 8/4/20 12:33 PM, Petar Kirov [ZombineDev] wrote:
 
 Edit: I meant this one: https://dlang.org/spec/module.html#scoped_imports
Ah, yes! imports of symbols never override local symbols unless you use selective/rename import. We'll have to think about how to rewrite the example/docs Thanks! -Steve
Aug 04 2020