WSDL definitions without namespace - web-services

I can do in WSDL definitions that is not in any namespace?
I want do half objects have namespace and other don't have.

Why do you want your elements to be without any namespace?
If you mean not prefixing any elements with any namespace, that is using the default namespace. You can read more about it here which also has a pretty illustrative example.

Related

Why we need 'namespace scope' concept? - in C++

I learned that in namespace "name decoration(mangling)" takes place so that it can be differentiated from other same identifiers which is in different namespace.
Wiki: Name mangling
If then, Why "namespace scope" exists? I thought just 'name decoration' can solve all problem about name conflicting.
Because in C, the reason for name conflicting is eventually that "different entities have same identifier".
Name decoration can make names(identifiers) different from each other internally, so I think name decoration is what all we need.
Then, why C++ use 'namespace scope' concept? Just for to use unqualified name in namespace scope? I want to know if there is any reason.
Namespaces scope is very useful in programming for the following reasons:
Avoids name collisions between functions/classes, eg., Suppose you have two functions of same name but in different namespace scope (foo::func() and bar::func())
Can be used for managing similar functions inside it, eg., sin(), cos() and sqrt() function could be under namespace Math.
Avoids confusion between classes for an example suppose there's two classes named lexer, but in different namespace scope like json::lexer and xml::lexer. Now, it gives clear understanding to the programmer to choose between them according to their language i.e, xml or json.
An everyday example of namespace could be std, stands for standard, it contains every single functions and classes defined in the standard library, it also includes STL classes like std::vector, std::map and std::string.
NOTE: There's no concept of namespace scope in C.
Namespace scope is a concept in the programming language that the developer sees, allowing them to organise their code effectively and understand it better. Name mangling is something the compiler does under the hood in order to implement namespaces (including namespace scope) in a way the linker can understand. In normal circumstances the developer doesn't need to think about name mangling, although its useful to know how it works.

Declare variables in unnamed namespace

In my current job, I am seeing variables declared in the unnamed namespace in the cpp file and used only by that class as if they are member variables.
I see it as an interesting way of keeping only interface information in .h and implmentation in .cpp and is less work than the usual pimpl idiom.
I see people using pimpl all the time but never this approach, is there any problem with it?
Variables declared in the unnamed namespace of a .cpp file are file scoped; this means that there is only one instance per execution of the program.
You can see this for yourself by creating two instances of your object and observing that they interfere with each other's variables in the unnamed namespace.
Show some example code please. AFAIK, you cannot declare member variables in the unnamed namespace (unless the class itself is declared in the unnamed namespace).
The unnamed namespace was introduced to replace the common practice of declaring variables as static that are used in just one compilation unit.

C++ namespace and static variables

I have a requirement where a (const) variable should be available throughout an entire cpp which consists of several classes. I have decided to use a namespace to solve the problem, but unsure about the following:
Do I need to define this variable as static?
Is it true that I can avoid making the variable static only if I go with an unnamed namespace?
You don't need to define the variable as static, or in an anonymous namespace. However, if you're not using this object outside of the file it's defined in, it's a good idea, to reduce namespace pollution and speed up links (by reducing how many symbols need to be considered by the linker).
If you declare a variable in an anonymous namespace, it will be effectively static. There's no need to actually make it static as well (although you can if you like). The advantage of anonymous namespaces is you can also define types (classes, structs, enums, typedefs) as well as static variables and functions.

Injecting types from nested namespaces: Typedef or using?

I have a large software framework which is currently living in a common namespace. Recently, I've moved some classes into nested namespaces, but in order to preserve backwards compatibility for the time being, I need to keep the names in the global namespace. So far, I'm using using:
namespace framework {
namespace IO {
struct IStream;
}
#if COMPATIBILITY
using IO::IStream;
#endif
}
However, I could equally well use typedef IO::IStream IStream;. Is there some advantage/disadvantage of using typedef over using?
They're somewhat different things: The typedef introduces a new type name framework::IStream, whereas the using directive only affects the name lookup inside the scope in which it appears. (This has additional effects if you were to also define a separate, genuine type framework::IStream, but since you're not doing that, this isn't an issue.)
In that sense I'd say that using is an implementation detail, which is preferable over a global change of semantics that would come from introducing a new type name. So if you can get away with it, use the using directive in those scopes where it's needed, and you can gradually migrate those to the new system.

How do clojure multimethods use namespaces?

I declare a multmethod with defmulti but then I have defmethods scattered all around my code base and it seems to "just work" without having to declare any explicit namespace in front of the multimethod declaration! Is this because all multimethods use some form of global namespace?
You don't need to repeat the multimethod's namespace in front of the multimethod's name because you have already referred the multimethod's name in your namespace, probably via the use of :use in the namespace decl.