Author Topic: Are modules always single level or is there any (future) concept of nesting  (Read 5889 times)

lerno

  • Full Member
  • ***
  • Posts: 247
    • View Profile
C++ allows nested namespaces, which means we can have foo::bar::baz() (in C++). For C2, will modules always be single level?

For example if one encounters foo.bar.baz(), can I then be sure that foo is either the module name or the name of a variable defined in the local module – or imported as local?

And can I be sure that bar here can never be part of a module name?

I'm pretty sure that this is true right now, but what about the future – are any future ideas that could change this?

bas

  • Full Member
  • ***
  • Posts: 220
    • View Profile
I have played around with this, but wanted to avoid the hassle in Java where everything is nested 6 deep.
Since C did exist 40 yeas with a single level (ie the global namespace), having 2 namespaces already
seems like a big improvement. When programming in C2, there is never any hassle with clashing
module names, but I do use the convention of naming files somewhat after the module name. If a module
consists of multiple files if use: foo_utils, foo_api, etc

lerno

  • Full Member
  • ***
  • Posts: 247
    • View Profile
That's fine with me. Might be useful to have that documented though. I only knew from certain from reading the source :D

bas

  • Full Member
  • ***
  • Posts: 220
    • View Profile
will do..