Closed lucacasonato closed 1 year ago
This is a feasible but also pretty hacky workaround here, and it's strange to me to make from
a quasi-reserved word again.
@ljharb The other option is to do nothing, in which case we incur an at most 3 token lookahead.
I don't have a very strong preference, but I want to note that if we ban this, we can always lift it later if it turns out the restriction was unwarranted.
If the syntax changes to import.<phase>
then it would be moot, yes?
@ljharb that was only for the dynamic case - import.<phase>(expr)
. The static case is not changing, and that was clarified with Ron as well.
I don't personally have an issue with import source from from 'test'
and import from from 'test'
both being supported either.
ah, i missed that. I have a mild preference for the static syntax to also be import.phase
tbh. why can't that be an option?
@ljharb I don't think we considering changes the fundamental static grammar at this stage of the proposal process. The dynamic case falls under the existing import.meta
meta property convention and was justified by the TypeScript folks for some valid reasons. Whereas the language doesn't have any precedent for static grammar using .
without it meaning a meta property or member expression.
OK, but that still doesn't mean this arbitrary grammar error is an ideal solution :-/
@ljharb would you prefer we revert this syntax error? Our thinking was to be cautious about this case, but if you have concerns about the error we can revert too.
I'd like it to be discussed further before advancing with the change, but I don't think you need to revert it now. It's fair that this is an easier restriction to remove than to add later, though.
Just for the record, this PR bans import source from from "x"
but not import source fr\u{6f}m from "x"
. I think this is good, since the second is absolutely unambiguous. Obviously a linter should also ban the second, but it's not the spec's job to do it.
This commit bans
import source from from
by adding an early error for this syntax production.Closes #42