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.

Weird proposal: operator invoke extension on context

See original GitHub issue

Ok. This is a weird, but let me shoot it here. How about instead of writing:

withContext(UI) { 
    updateSomethingInMyUI()
}

we could just write:

UI { 
    updateSomethingInMyUI()
}

Does it make sense? 👍or 👎

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:12
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
qwwdfsadcommented, Jul 8, 2018

Not sure if UI {} won’t be confused with launch(UI) {}

1reaction
elizarovcommented, Jan 17, 2019

@LouisCAD 👍 Let’s try it as an extension for CoroutineDispatcher. We should start with an experimental inline function – it adds less weight to our public API. A member for this purpose is not Kotlinish. If the feedback is positive, then we’ll stabilize it after one release cycle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

multiple receivers on extension functions/properties : KT-10468
The proposal is to introduce the syntax for defining context-dependent declarations with special context receivers. Simply put, it is a kind of natural ......
Read more >
Where is the proposal for standardization of "extension ...
There is a proposal for Unified (var Uniform) Call Syntax for C++. From 10,000 feet PoV, it will allow extensions methods a la...
Read more >
Reactor 3 Reference Guide
We have callback-based services: a Callback interface with a method invoked when the asynchronous process was successful and one invoked when ...
Read more >
Rules for Operators - Scala Documentation
The rules for infix operators have changed in some parts: First, an alphanumeric method can be used as an infix operator only if...
Read more >
6. Expressions — Python 3.11.1 documentation
Some additional rules apply for certain operators (e.g., a string as a left argument to the '%' operator). Extensions must define their own...
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