-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
This issue was originally filed by [email protected]
In the specs it reads
libraryImport:
'#' 'import' '(' stringLiteral (', ' 'prefix:' stringLiteral)? ') ';'
;
This is utterly redundant.
I would like to suggest that this will be reduced to either
libraryImport:
'#' 'import' stringLiteral 'as' stringLiteral;
;
or, by making this more 'compatible' to CommonJS
libraryImport:
stringLiteral = 'import' stringLiteral;
;
The extra opening and closing brackets are not really necessary unless
import was a function, which it definitely is not.
And if it were, then the '#' hash before the 'import' keyword should be removed, leaving us with
libraryImport:
stringLiteral = 'import' '(' stringLiteral ')';
;
Having this, one could also just import specific elements declared by the library, such as
foo = import('bar').foo;
or, using the import...as notation
libraryImport:
'import' '(' stringLiteral ')' ('as' stringLiteral)?;
;
However, using stringLiteral for the prefix is rather weak, as it definitely needs to be an identifier.