<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/language-feature/namespaces/using-namespace.slang.expected.txt, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2020-08-20T15:23:51+00:00</updated>
<entry>
<title>Initial support for a using construct (#1506)</title>
<updated>2020-08-20T15:23:51+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-08-20T15:23:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=11748a75e66c2bd3fa7ef7635fd35363465f599c'/>
<id>urn:sha1:11748a75e66c2bd3fa7ef7635fd35363465f599c</id>
<content type='text'>
The basic idea is that if you have a namespace:

    namespace MyCoolNamespace { void f() { ... } ... }

then you can bring the declarations from that namespace into scope with:

    using MyCoolNamespace;
    f();

The `using` construct is allowed in any scope where declarations are allowed. As an additional feature, the construct allows and then ignores the keyword `namespace` if it occurs right after `using`:

    using namespace MyCoolNamespace;

Note that unlike in C++, `using` a namespace inside another namespace doesn't implicitly make the symbols available to clients of that namespace:

    namespace hidden { void secret() {...} ... }
    namespace api { using hidden; ... }

    api.secret(); // ERROR: `secret()` isn't a member of `api`

The implementation of this feature was relatively simple, although it does leave out more advanced features that might be desirable in the future:

* No support for `using MCN = MyCoolNamespace` sorts of tricks to define a short name

* No support for `using` anything that isn't a namespace (e.g., to make the members of a type available without qualification)

* No support for cases where multiple visible modules have a namespace of the same name (or dealing with overloaded namespaces in general)</content>
</entry>
</feed>
