# POLL: Remove usingnamespace

**URL:** <https://ziggit.dev/t/poll-remove-usingnamespace/6131>\
**Category:** Brainstorming\
**Tags:** language\
**Created:** [September 25, 2024, 6:19am UTC](https://ziggit.dev/t/poll-remove-usingnamespace/6131 "2024-09-25T06:19:33Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![biosbob](https://ziggit.dev/user_avatar/ziggit.dev/biosbob/32/1987_2.png) [@biosbob](https://ziggit.dev/u/biosbob)\
**Post date:** [September 25, 2024, 2:24pm UTC](https://ziggit.dev/t/poll-remove-usingnamespace/6131/12 "2024-09-25T14:24:07Z")

</div>

i’m still a relative newcomer to zig, so i’m not necessarily aware of some of “deep” implementation issues as well as all of the design alternatives…

having had a favorable experience with namespaces back in C++, i immediately knew the situations where this feature would be helpful…

based on the description in the docs (plus examples at this forum), it initially struck me as a very convenient way to merge disjunct source files with lots of top-level declarations… the alternative would have me explicitly creating a top-level file whose declarations are basically “renames” of internally imported declarations…

but as i progressed further in my design of **Zig•EM** i relied on `usingnamespace` in a rather novel manner… to illustrate, here’s an [example](https://blog.zigem.tech/post-003/#__codelineno-1-1) from a recent article of mine…

long story short, but each `.em.zig` source file is compiled **TWICE** in the **Zig•EM** framework: first with the file’s top-level declarations merged with the `EM __META` namespace; and then with the file’s top-level declarations merged with the `EM__ TARG` namespace…

[[read on in this article to understand the motivation]]

lacking `usingnamespace`, i could very easily generate **TWO** derivative source-files that respectively merge in the `EM __META` and `EM__ TARG` declarations… i’m not sure whether there is an alternative solution using other language constructs…

i’m not sure that the [Mixin](https://ziggit.dev/t/mixin-alternative-using-const-declarations/6091) alternative described by @AndrewCodeDev would apply here… a recent [topic](https://ziggit.dev/t/source-code-rewrite-transformations/6119/6) talking about “source code rewrite transformations” had @mnemnion suggesting a solution with `usingnamespace` 😉

in summary, it’s essential in my current framework design… but if i start doing some upstream source-code transformation anyway (for situations for which there is my only alternative), then i can easily subsume my current use-cases for `usingnamespace`…

---

_[View the full topic](https://ziggit.dev/t/poll-remove-usingnamespace/6131)._
