Re: Question about doc style
- Posted by irv Sep 07, 2019
- 867 views
I notice that in many (most?) of the docs, an example is given like the following:
include std/console.e namespace console
Secondly, "we" know that the second line is just reminding us that a namespace has already been assigned to std/console.e (don't we?).
As I understand it, the second line is a brand new namespace applying to this file, whereas
include std/console.e as console
would be the one that (needlessly) replicates the existing namespace already defined within std/console.e.
That is correct, except that a file's namespace has to be declared before any other line of code in that file, (except comments, I think) so putting it after the include std/console.e line is just going to result in a "Unknown namespace used" error.
We can't cause trouble by doing that, because Eu catches the error. But if it is invalid, then the docs shouldn't show it as if it was. A slight change so that it's clearer, such as:
include std/console.e -- all console.e functions have the default namespace "console:"
That would avoid implying that you should ever add a namespace x line after an include.