question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Since we’re breaking (binary, at least) compatibility in the next release, I think it’s a good time to consider the list of keywords we have in the language, and whether we should do a minor break to source compatibility to add new keywords.

So the question is: what syntax do we have (or propose) that would be improved by the addition of a keyword?

The only one that comes to mind immediately for me is the syntax for destructuring statements (discussed here #6446). By adding a new keyword (values, perhaps), we could “fix” the syntax for a destructuring statement, resulting in:

values (key -> item = 1->2,
       [first, *rest] = 1..10;

And:

values (Integer key -> Integer item = 1->2,
       [Integer first, Integer* rest] = 1..10);

Is there any other language feature like that?

The second thing that comes to mind is async/await. Are we going to need new keywords for that? Should we reserve them now?

(Please let’s not turn this thread into a long re-discussion of #6446. The topic is keywords.)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
zamfofexcommented, Aug 23, 2017

I tend to dislike writing functions with (a lot of) side effects, but it seems other people like them. Either way, I think reserving a yield keyword might not be the worst idea, just in case.

#3418, #4391

1reaction
zamfofexcommented, Jan 15, 2018

@IamSungod

This era requires fine-grained massive concurrency.

I thoroughly agree (in fact, I was thinking about it just the other day), so I’ve been reading about Kotlin coroutines for the last couple minutes, and it doesn’t seem to me as if runBlocking is implementable in JavaScript (unless every generated JS function is marked as async).

The async and launch functions (which can only be called from suspend functions) do basically the same as async does in JavaScript.

So I don’t really see how this is more expressive or better than JavaScript’s concurrency using async and await. Without runBlocking, it seems to me like it’s just merely defined by less generic features, as it is a hardspecced feature, and not just syntactic sugar, even though it’s conceptually the same.

I would just have an asynchronous annotation that makes the function return a promise and an await expression which waits for a promise to be finished that can only be used inside asynchronous functions.

As a demonstration, here is the port from Kotlin to JavaScript of the program used as an example in the page I’ve linked:

let range = (s, e)=>({[Symbol.iterator]: function*() {for(let i = s; i <= e; i++) yield i;}});
let hold = s => new Promise(d=>setTimeout(d, s*1000));
let workload = async n => ((await hold(3)), n);
let sum = 0;
for(let i of [...range(0, 100000)].map(workload))
{
    sum += (await i);
}
console.log(sum);
Read more comments on GitHub >

github_iconTop Results From Across the Web

New Keywords: A Revised Vocabulary of Culture and Society
The New Keywords is a comprehensive resource for everyone furthering their studies in cultural and literary theory. In addition, students involved in ...
Read more >
Best practices for finding new keywords - Google Ads Help
Best practices for finding new keywords · 1. Think like your customers · 2. Be specific but not too specific · 3. Add...
Read more >
New Keywords: A Revised Vocabulary of Culture and Society
New Keywords : A Revised Vocabulary of Culture and Society is a state-of-the-art reference for students, teachers and culture vultures everywhere.
Read more >
New Keywords - Wikipedia
New Keywords : A Revised Vocabulary of Culture and Society is a book edited by Tony Bennett, Lawrence Grossberg and Meaghan Morris and...
Read more >
Free Keyword Tool - WordStream
Free Keyword Tool. Discover new keywords and performance data to use in your site content, Google Ads campaigns and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found