A question about library extensions and namespaces

  • Thread starter Matthias =?ISO-8859-1?Q?K=E4ppler?=
  • Start date
M

Matthias =?ISO-8859-1?Q?K=E4ppler?=

Hello,

say I want to extend an official GUI library by a new widget class. And say,
this library lies in its own namespace. Should I embed my new class as well
in that particular namespace, even if it's not officially a part of the
library?
I'm talking about gtkmm. I'm implementing a file browser widget and I'm not
sure if it's a good or bad idea to put it in the Gtk namespace.

Thanks in advance,
Matthias
 
J

Jonathan Mcdougall

say I want to extend an official GUI library by a new widget class. And say,
this library lies in its own namespace. Should I embed my new class as well
in that particular namespace, even if it's not officially a part of the
library?

Logically, if you plan to ship your extensions with a given library (by
contacting the maintainers for example), these should go in the same
namespace. If not, it is usually better to use another namespace.

As far as the language is concerned, the use of namespaces prevents name
clashes. If, for example, one of your class extends or modifies the
original, using your own namespace will allow you to keep the same name.


Jonathan
 
M

Matthias =?ISO-8859-1?Q?K=E4ppler?=

Jonathan said:
Logically, if you plan to ship your extensions with a given library (by
contacting the maintainers for example), these should go in the same
namespace. If not, it is usually better to use another namespace.

I don't plan to ship it with gtkmm. It's more of an (optional) extension you
can easily embed in your gtkmm apps. It's a Gtk::ScrolledWindow in fact.

So I better do not put it in the Gtk namespace.

Thanks,
Matthias
 
J

Jonathan Mcdougall

Logically, if you plan to ship your extensions with a given library (by
I don't plan to ship it with gtkmm. It's more of an (optional) extension you
can easily embed in your gtkmm apps. It's a Gtk::ScrolledWindow in fact.

So I better do not put it in the Gtk namespace.

If that's not part of the gtkmm library, it does not logically belong to
its namespace.


Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top