Thread overview
Documentation error
Aug 04, 2020
Flade
Aug 04, 2020
Flade
August 04, 2020
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!
August 04, 2020
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
August 04, 2020
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
August 04, 2020
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
August 04, 2020
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!
August 04, 2020
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