Questions tagged [qualified-name]

A name that includes the full path of the containing class, eg java.util.ArrayList

Analogous the an absolute path in a filesystem, the name includes the full path of the containing/enclosing class.

62 questions
58
votes
1 answer

Is it a good practice to call functions in a package via ::

I'm writing some R functions that employ some useful functions in other packages like stringr and base64enc. Is it good not to call library(...) or require(...) to load these packages first but to use :: to directly refer to the function I need,…
Kun Ren
  • 4,715
  • 3
  • 35
  • 50
54
votes
2 answers

Why isn't a qualified static final variable allowed in a static initialization block?

Case 1 class Program { static final int var; static { Program.var = 8; // Compilation error } public static void main(String[] args) { int i; i = Program.var; System.out.println(Program.var); …
Ravi
  • 30,829
  • 42
  • 119
  • 173
21
votes
2 answers

How do I write the qualified name of a symbol in Haskell?

I've got a name clash between two different Haskell modules that want to use the same infix operator (<*>). The Haskell 98 report says that modid.varsym is permitted, but I can't get it to work. In their entirety here are Test.hs: module…
Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
15
votes
2 answers

Do Derived1::Base and Derived2::Base refer to the same type?

MSVC, Clang and GCC disagree on this code: struct Base { int x; }; struct Der1 : public Base {}; struct Der2 : public Base {}; struct AllDer : public Der1, public Der2 { void foo() { Der1::Base::x = 5; } }; Godbolt GCC: :…
14
votes
3 answers

Is a fully qualified class name down to global scope ever required for out-of-line member function definitions?

This question got me wondering whether it is ever useful/necessary to fully qualify class names (including the global scope operator) in an out-of-class member function definition. On the one hand, I've never seen this done before (and the syntax to…
14
votes
3 answers

Haskell *qualified* import of a set of functions

In Haskell, I can import a module qualified by its name or a shortcut name, like so: import qualified Data.List as List import qualified Data.Map I can also import only a select set of functions from a module, or import all functions other than a…
ely
  • 74,674
  • 34
  • 147
  • 228
11
votes
5 answers

Unqualified name in Java

The teacher in our programming lessons is talking about "unqualified names", but I'm wondering what they really are. I suspect that things such as method names are unqualified, but I'm not certain. Is there anyone who can explain this to me? I need…
user4424299
8
votes
1 answer

Ambiguous name lookup with using-directive

It's not allowed to put a namespace and a class with the same name into one declarative region, i.e. namespace A {} class A{}; is ill-formed (see §3.3.1/4). However, one can introduce the name of either one via a using-directive: namespace N {…
Columbo
  • 60,038
  • 8
  • 155
  • 203
7
votes
2 answers

Is qualified name in the member function declaration allowed?

This code is accepted by MSVC9.0. My question is whether it is legal according to the standard (the old and/or the new one). A quote would be very much welcome, too. class X { void X::f(); };
Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
7
votes
2 answers

In Java, why is it possible to qualify an Enum Constant with another Enum Constant?

Recently, I've noticed, it is possible to have: class Test { public enum Season { WINTER, SPRING, SUMMER, FALL } Season field = Season.WINTER.SPRING; // why is WINTER.SPRING possible? } Is there a reason for this?
John Assymptoth
  • 8,227
  • 12
  • 49
  • 68
7
votes
1 answer

explicit qualification in C++ declaration

The following namespace definition fails to compile when the first declaration is commented out. If the first declaration of foo is uncommented, then it compiles just fine. namespace Y { //void foo(); void ::Y::foo(){} } The relevant part…
Hector
  • 2,464
  • 3
  • 19
  • 34
7
votes
1 answer

What is a qualified/unqualified name in Python?

In Python: what is a "qualified name" or "unqualified name"? I've seen it mentioned a couple of times, but no explanation as to what it is.
Niels Bom
  • 8,728
  • 11
  • 46
  • 62
6
votes
1 answer

Qualified name in namespace declaration

After reading MSDN-XAML Namespaces and MSDN-Understanding XAML Namespaces, I still do not understand the purpose of having a Qualified Name (QName). Take the following namespace declaration as an…
KMC
  • 19,548
  • 58
  • 164
  • 253
5
votes
1 answer

Is it ok to qualify C functions with the `std` namespace?

When I use functions inherited from C, like the ones in or , should I qualify them as being part of the standard namespace std::log, or should I remain in the C-scope and use them as global functions? What about size_t?
Paul Manta
  • 30,618
  • 31
  • 128
  • 208
5
votes
2 answers

"extra qualification" errors. How warranted by the Standard?

This similar ill-fated question got comments and short answers, before it was closed, to the effect: Because that's how the language is defined. Here I am asking for the evidence within the C++ Standard that it is so defined. gcc 4.8.1 and clang 3.3…
Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
1
2 3 4 5