More compact specification of nested namespaces

0 votes
asked Jul 14 in Wanted features by dmf19 (120 points)
edited Jul 14 by dmf19

As far as I can tell, nested namespaces need to be specified in an actual nested structure, otherwise they display as separate namespaces with the names containing the namespace separator.

For example, the following plantuml

@startuml

namespace a {
}
namespace a.b {
}
namespace a.c {
}

namespace d {
    namespace e {
    }
    namespace f {
    }
}

'namespace g
'namespace g.h
'namespace g.i

@enduml

shows namespaces d, e and f correctly nested, but a, b and c are not.  What I would like to be able to do is specify the namespaces g, h, and i as shown (commented here as they generate an error), without braces, and for plantuml to infer the nested structure and display accordingly.

If it is preferred to retain the option of displaying a non-nested structure, it could be made a setting (eg. set autoNamespaceNesting on).

The existing ability to place classes within nested namespaces, by specifying the full namespace name,  is VERY useful and my requested feature would complement this.

It could potentially be taken even further...

Assuming you did not need to add attributes (eg. background colour) to the namespace, you could infer the nested namespace structure purely from the fully-specified class names.  Hence there would be no need to specify the namespaces at all.  This could also be made a setting (eg. set autoNamespaceCreation on).

1 Answer

0 votes
answered Jul 17 by plantuml (208,400 points)
Thanks for the feedback.

Namespace support have been added lately in PlantUML... This looks really as a bug.

Your example should work better in last beta http://beta.plantuml.net/plantuml.jar

Tell us what you think about it !
...