Live data from Hacker News

On 'function coloring' (2018)

tedinski.com

21–22 of 22 posts

Re: On 'function coloring' (2018)

#21
post #4

I often hear that if a distinction exists, it should be represented in the type system; functions are either async or not, so we should track it at compile time. The thing most people don't understand about language design is that if you follow this line of thinking to the extreme, your complexity goes through the roof as all of the infectious constraints spread upward through your call graph, sometimes conflicting w…

I think the view of asynchronous functions as "upwardly infectious" comes from focusing too much on JavaScript. Async/Await arguably[1] first debuted on C#, and in C# you could always call Task.Wait() or Task.Result to block on the Task returned from the code. Similarly, Python async coroutines can be run from blocking functions using event_loop.run_until_complete(coroutine). Kotlin similarly has runBlocking(). Runni…

> Loom does not completely do away with function colors in Java, unfortunately, and yellow functions still remain. For instance, any synchronized method or block is yellow and cannot be called from virtual threads

AFAIK, they only pin the thread. They are absolutely callable, you just don’t get all the advantages.

Re: On 'function coloring' (2018)

#22
post #14
post #4

I often hear that if a distinction exists, it should be represented in the type system; functions are either async or not, so we should track it at compile time. The thing most people don't understand about language design is that if you follow this line of thinking to the extreme, your complexity goes through the roof as all of the infectious constraints spread upward through your call graph, sometimes conflicting w…

Rust is getting keyword generics to be polymorphic over sync/async which, uh, I'm not sure if I'm a huge fan of: https://blog.rust-lang.org/inside-rust/2022/07/27/keyword-ge...

The community has almost unanimously shown their distaste for this proposal, so I wouldn't count on it shipping.

The consensus was that it provides almost no practical value and is a heavy syntactical burden both to read and write.

Many users seemed to be totally fine keeping function colors over adopting this.

Post reply on HN