public imports
Paul Backus
snarwin at gmail.com
Wed Dec 5 21:30:04 UTC 2018
On Wednesday, 5 December 2018 at 21:13:29 UTC, Sjoerd Nijboer
wrote:
> A small question.
> Is it intended behaviour that public imports inside function
> calls fail with the message "Error: found public instead of
> statement", or is it an underdocumented feature?
>
> void foo()
> {
> public import bar;
> }
An import statment inside a function is already limited to that
function's scope, so making it public doesn't really make sense.
That said, the language specification [1] doesn't say anything
about this kind of import being an error, so it's definitely
underdocumented. The error message is also not as good as it
could be.
[1] https://dlang.org/spec/module.html#scoped_imports
More information about the Digitalmars-d-learn
mailing list