-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNamespaces.qs
34 lines (28 loc) · 888 Bytes
/
Namespaces.qs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Examples of using namespaces and open directives
// to organize code and access callables.
namespace A {
operation F(a : Int) : Unit { }
}
namespace B {
open A;
operation F(a : Double) : Unit { }
operation CallF() : Unit {
// The current namespace has precedence over any open namespaces,
// so operation name F resolves to B.F.
F(2.0);
// You can still use a fully qualified name to access A.F.
A.F(2);
}
}
namespace C {
open A;
open B;
operation CallF() : Unit {
// Neither A.F nor B.F have precedence, so using unqualified name for F
// would produce an error asking for a fully qualified name.
// let res = F(2);
// Using a fully qualified name allows to disambiguate.
let resI = A.F(2);
let resD = B.F(2.0);
}
}