Each Freya file may list a global using clause as its first syntactic construction, before any namespaces. Each namespace declaration may include its own using clause list, with local scope.
A using clause lists namespace prefixes that can be omitted in type references inside the same file or namespace:
using qualified-identifier , ... ;
These qualified identifiers represent namespaces. This is a typical file skeleton in Freya:
using System; namespace Freya.DataStructures; using System.Collections.Generic, System.Text; public // ... namespace IntSight.Demos; using Freya.DataStructures; public // ... end.
Rules for name resolution in Freya are the same as those from other .NET languages.
This means that you cannot apply a using clause to shorten the length of a namespace. For instance, if you have mentioned System in a using clause, you cannot write Collections instead of System.Collections because System.Collections is a namespace identifier. However, you can write IDisposable, since System.IDisposable is a class identifier.
This rule has been included to prevent ambiguity. Suppose that you have two types: A.X and B.C.X. You can use a clause like this:
using A, B.C;
However, you cannot write just X, because the using clause allows two interpretations for this identifier. In this case, you must use the full qualified type name for both types.
The Freya Programming Language
Program and file structure
Lexical structure
Projects and source files
Namespaces
Implementation sections
The entry point
Type declarations