-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unexpected output for await somePromise\n.property
#4847
Comments
This is also how we would want it to behave, I would think. Consider a non-meaningless example: do ->
await S3.putObject(params).promise()
.then (data) ->
console.log data (async function() {
return (await S3.putObject(params).promise().then(function(data) {
return console.log(data);
}));
})(); |
here's the code that failed for me because of this: @directoryList = do =>
try list = await fs2.readdir @folder
catch then return []
filterAsync list, (fileOrFolder) =>
await fs2.lstat _path.join @folder, fileOrFolder
.isDirectory() also in your example (i'm not familiar with that lib), wouldn't it be more likely to have do ->
data = await S3.putObject(params).promise()
console.log data or simply omitting that aside, your output could be achieved with |
It’s this library. And sure, you’re probably right, your version would be more readable; I just already have code written using the chained promise style, so that’s what I copied. But my example illustrates what you’re proposing here: changing how chaining behaves when it follows |
In case of I understand that a breaking change is undesired but current compilation is bug prone as it doesn't follow CS' whitespace-significance. If no action is taken, then by the time CS3 might become a thing, current logic will be well known and likely won't be changed. Just like it was the case with ES6 |
|
Nice catch, wasn't aware of that feature. |
CS3 is a long way off. And I feel like if CS3 has a theme, it will be “clean up,” as in, clean up scope and chaining and other things that we didn’t change for CS2 because of concerns about breaking changes, but would like to change to clean up the language. But again, I don’t know when or if that will happen, or who is motivated to put in the work. I don’t think the wish list of stuff we’d like to refactor is long enough or important enough to motivate the small army we had pushing CS2 forward, at least not yet. There’s also something to be said for never making those changes, and avoiding a split like that happened between Python 2 and 3, which would weaken the CoffeeScript ecosystem even more than it already is. All that said, should I close this? And we can start a wiki page for the CS3 wish list, and it could include this plus block scope and fixing the chaining syntax once and for all, among other items. |
sounds good 👌 |
@GeoffreyBooth wrote a draft CS3 Wishlist |
example:
current output:
expected output:
The text was updated successfully, but these errors were encountered: