Closed TheSpyder closed 2 years ago
async
is not a keyword, as you're observing.
The second line looks like might be recognised by the parser as the beginning of a function definition. Would you move this to the syntax repo? It could be that when =>
is missing, the case could be handled differently when in an async context. Since it's a syntax error, there's low risk trying to change that case see what happens. Though it could be that some complex backtracking is required in which case one would have to assess whether it's worth it.
So this is clearly an error:
let _ = (~a=1, 1)
but this (after desugaring)
let _ = @res.async (~a=1, 1)
could be handled differently
I don't have move access 🤔 or did you want me to close and re-log?
Let me do it.
Example of redefined async
function that works:
let async = (a, b) => a+b
let r = async(1, 1)
Thank you! I'll test it as soon as I can.
I'm migrating my codebase to 10.1 and I have functions called
async
(someexternal
, somelet
) that were defined long before ReScript considered adding async/await.Is this supposed to be allowed now that
async
is a keyword? Simple functions work, but functions with named arguments throw a syntax error after the function call such asDid you forget a => here?
when I attempt to call them:I'm happy to say redefining
async
shouldn't be allowed, but thenlet async
andexternal async
should trigger an error rather than at the call site.