A pod import will import all the types from that pod into the compilation unit's namespace.
A type import will import a specific type with the qualified type name. This type of import overrides any pod level imports for the type identifier (like Java).
An as import let's you import a type and rename it for the local compilation unit. This type of import clears the import of the original name and overrides any names with the new name.
import web
import web::WebReq
import web::UserAgent as WebUserAgent
In the example above we import all the types from web. But WebReq will trump any other imports which might have been imported with the name WebReq. The name UserAgent will not be available, but I can identity web::UserAgent using the name WebUserAgent. This is similar to how java imports work, but with the added convenience of the import as (for those times when you need to work with both types).
Note this feature will only be available in the Fan version of the compiler.
brian Thu 27 Jul 2006
In the fan version of the parser I'm going to allow fully qualified types:
I'm going to allow "type imports":
And I'm going to allow "renamed type imports":
brian Tue 1 Aug 2006
Ok the new grammar for imports is:
A pod import will import all the types from that pod into the compilation unit's namespace.
A type import will import a specific type with the qualified type name. This type of import overrides any pod level imports for the type identifier (like Java).
An as import let's you import a type and rename it for the local compilation unit. This type of import clears the import of the original name and overrides any names with the new name.
In the example above we import all the types from web. But WebReq will trump any other imports which might have been imported with the name WebReq. The name UserAgent will not be available, but I can identity web::UserAgent using the name WebUserAgent. This is similar to how java imports work, but with the added convenience of the import as (for those times when you need to work with both types).
Note this feature will only be available in the Fan version of the compiler.