C2 forum

General Category => General Discussion => Topic started by: lerno on November 20, 2018, 08:05:55 PM

Title: Are modules always single level or is there any (future) concept of nesting
Post by: lerno on November 20, 2018, 08:05:55 PM
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?
Title: Re: Are modules always single level or is there any (future) concept of nesting
Post by: bas on November 27, 2018, 10:00:55 AM
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
Title: Re: Are modules always single level or is there any (future) concept of nesting
Post by: lerno on November 27, 2018, 02:40:57 PM
That's fine with me. Might be useful to have that documented though. I only knew from certain from reading the source :D
Title: Re: Are modules always single level or is there any (future) concept of nesting
Post by: bas on November 29, 2018, 08:19:14 AM
will do..