This patch adds support for Python style from ns import symbol at the grammar level and also allows for aliased symbol names.
The following constructs are supported:
import Ast(ReferenceExpression as RefExp) # RefExp
import Ast(ReferenceExpression as RefExp) as A # A.RefExp
from Ast import ReferenceExpression as RefExp # RefExp
from Ast import NullLiteralExpression, ReferenceExpression as RefExp # NullLiteralExpression, RefExp
from Ast import * # All symbols from Ast, just like "import Ast"
Coming from a scripting languages background I tend to prefer explicit symbol importing over namespace imports, probably because I'm not used to IDEs to provide real intellisense style suggestions. While current Boo selective import syntax gets the job done I find Python's style easier to read. I also assume that many people being introduced to Boo will have probably some experience with Python, a compatible syntax for imports will probably help them in the transition.
Important: I haven't included any unit tests yet or modified the WSA grammar, I wanted to present the changes first to know if they would be ok for you.
This patch adds support for Python style
from ns import symbol
at the grammar level and also allows for aliased symbol names.The following constructs are supported:
Coming from a scripting languages background I tend to prefer explicit symbol importing over namespace imports, probably because I'm not used to IDEs to provide real intellisense style suggestions. While current Boo selective import syntax gets the job done I find Python's style easier to read. I also assume that many people being introduced to Boo will have probably some experience with Python, a compatible syntax for imports will probably help them in the transition.
Important: I haven't included any unit tests yet or modified the WSA grammar, I wanted to present the changes first to know if they would be ok for you.