Alias Keyword

Overview:

Add a new keyword alias. Which introduces an alias to an object or pattern name.

Proposed by:

Jeff Walker (language designer)

Experts to Contact:

jwalker@cs.oberlin.edu

Status: Being Considered


Reason:

This can be used like C#'s alias on import to provide alternate names to namespaces. It can also be used to provide alternate names to individual classes and functions. This could be important for declaring function types (consider C++ typedef of function types). If an alias were public in a namespace then it would be an imported name. It would also allow one to make a class seem to appear in multiple namespaces by placing aliases of it in multiple places.

Description:

You can alias a name to itself (in a differnt namespace). This allows C++ style inclusion of things into differnt namespaces. These names are synonyms for the orignal type and do not introduce a new type. This could be done by leaving off the name to change it to. One concern is that this should fit with the importing scheme since aliasing to the same name is a lot like importing.

Maybe this should be connected to some kinda of new := form. So aliasName := orignalTypeName; This is currently not allowed. But it would be a named entity of an anonymous type, the type that is assigned into it. Of course there is no greate way to bring a name in as itself unless you double list the name, but maybe that isn't so bad i.e. ClassName := SomeNamespace.ClassName; This also lets you apply any scoping you want to it which is interesting becuase then you can apply protected scope to it. Now that is a difference with using import or alias. How do you bring in many objects := SomeNamespace.**; seems really bad.

Example:

private alias Foo.SomeClass NewName;
public alias A.AnotherClass;


jwalker@cs.oberlin.edu