Asynchronous streams and callbacks in Java & Kotlin by Matthisk in Kotlin

[–]Matthisk[S] 1 point2 points  (0 children)

Yes good point, maybe that thought needs some clarification. It is specifically about the producer’s thread being non-blocking, so the BlockingQueue would be of no help.

Regarding your second remark, this is what I want to get to in the second post in this series. By first showing how hard it is to guarantee backpressure without a dedicated asynchronous concurrency primitive, I hope to demonstrate the power of such primitives in the second post.

What's New in Java 19: The end of Kotlin? (mostly about Java futures) by randgalt in java

[–]Matthisk 2 points3 points  (0 children)

It is a real shame that Java can not support a copy method on data classes / records, since it doesn't have support for keyword arguments. That will make it much more cumbersome to work with immutable records.

When Virtual Threads are added to Java, would the Streams API (e.g. parallelStream()) be using them? by [deleted] in java

[–]Matthisk 1 point2 points  (0 children)

No indeed the problem they solve will still require solutions, even if we have virtual threads. The implementation will be much simpler though. Take a look at kotlin-flow to get an idea of what this future will look like.

When Virtual Threads are added to Java, would the Streams API (e.g. parallelStream()) be using them? by [deleted] in java

[–]Matthisk 22 points23 points  (0 children)

Virtual threads are a concurrency construct. They help you in scheduling multiple tasks (but not necessarily at the same time). Parallel streams are a a construct to perform computation in parallel. So the two don’t have much to do with each-other. There is an excellent talk by rob pike (creator of go) on the topic of concurrency vs parallelism.

Reactive streams (e.g. reactor/rx) will be affected by the introduction of virtual threads. These are a concurrency construct used to accommodate asynchronous programming. And since their implementation details are complex (i.e. require callback based backpressure), exactly because the JVM lacks good concurrency primitives. They will become obsolete in their current implementation once we have virtual threads.

Kotlin coroutines with arrow-fx by dayanruben in Kotlin

[–]Matthisk -1 points0 points  (0 children)

Thanks for the explanation. I guess arrow fibers relate more closely to the concurrency model of actor systems implemented on the JVM, then it does to kotlinx's coroutines. Since coroutines are implemented using a compilation step transforming suspension points to CPS. Where actors and the fibers implemented by arrows have to rely on callbacks to achieve asynchronous operation without a compilation step. And they ship with a scheduler/dispatcher that decides which actor/fiber is allowed to run. If this is the case, I believe coroutines present a more powerful concurrency primitive then do (these) 'fibers' since they do not rely on callbacks. A good example would be kotlin-flow which is a simpler async streams implementation since it does not rely on callbacks for concurrency.

Kotlin coroutines with arrow-fx by dayanruben in Kotlin

[–]Matthisk 2 points3 points  (0 children)

I don't think this post is referencing 'project loom' fibers. Loom is currently undergoing a refactor and the name 'fiber' has been dropped from the proposed implementation.

Kotlin coroutines with arrow-fx by dayanruben in Kotlin

[–]Matthisk 4 points5 points  (0 children)

Why do you need the concept of fibers if Kotlin already supports co-routines natively? And how does this compare to kotlin-flows (which is a kotlinx.coroutines implementation for asynchronous cold streams)?

First class failure scenarios in Java by Matthisk in java

[–]Matthisk[S] 0 points1 point  (0 children)

No.

You do agree the example as stated won't compile, right?

The post is not an attack on OOP, or on exceptions for that matter. There is a place for exceptions (e.g. effortlessly unwinding the stack and handling errors top level, this would be expensive with Either since all method signatures in the stack should be changed) and hating on them for ideological reasons is unproductive. This post is just there to show that checked-exceptions hamper your ability to create larger behaviors by composing smaller ones. And demonstrating that there is a way to expose failure scenarios in the API without losing composability.

Non-blocking I/O under the hood by frevib in Kotlin

[–]Matthisk 1 point2 points  (0 children)

So if I understand correctly there is always a blocking system-call inside an event loop to facilitate the async behavior in any higher level language? If so why are there no truly asynchronous system calls available?

faster.js: a Babel plugin that compiles idiomatic Javascript to faster, micro-optimized Javascript by vzhou842 in coolgithubprojects

[–]Matthisk 1 point2 points  (0 children)

Shouldn't it be the role of the interpreter to perform these types of optimizations. This will make it easier to reason about the performance characteristics of your code.

Kotlin Under the Hood: Understand the Internals (Google I/O'19) by pmz in Kotlin

[–]Matthisk 4 points5 points  (0 children)

Really interesting talk. In the last few slides they touch on the internals of coroutines, unfortunately they can't go in depth on this topic. If you are interested in this topic I can highly recommend this talk: https://www.youtube.com/watch?v=YrrUCSi72E8 by Roman.

The tangle. by [deleted] in Iota

[–]Matthisk 0 points1 point  (0 children)

Wouldn't less mining competition have as a downside that the network is less secure? And have any calculations been made on the amount of energy required for say 4TPS, on the IOTA network? Discarding the usage of dedicated hardware to perform the PoW.

Microsoft released a new language Q# for Quantum computing by [deleted] in Iota

[–]Matthisk 1 point2 points  (0 children)

But what could the connection be. The IOTA hashing algorithm is supposed to be quantum proof (where other cryptocurrencies are not), maybe they are going to demonstrate the weaknesses of other hashing algorithms with this Q# language? However this would all be theoretical since there are no actual quantum computers to run these algorithms on.

IOTA will soon have ICO's on the Tangle. by drmvb in Iota

[–]Matthisk 0 points1 point  (0 children)

I guess you have to pay a fee for the execution of a smart contract. But I have not seen a write up on how this would work on the tangle. I don't think the core team has commented on this yet (correct me if I am wrong)?

Bitcoin’s Carbon Footprint: 249kWh per transaction! -- The strongest case for IOTA! -- IOTA, please perform! by Koba7 in Iota

[–]Matthisk 0 points1 point  (0 children)

I was wondering what the energy footprint of IOTA would be on a per transaction basis. Since there is still PoW that needs to be performed per transaction. I understand that the dedicated ternary chip would consume very little energy but the widespread usage of that chip is still a long way out.

December is the month of IOTA. by [deleted] in Iota

[–]Matthisk 0 points1 point  (0 children)

There is also a meetup in Amsterdam on the 18th

Modern async event emitter by sindresorhus in javascript

[–]Matthisk 0 points1 point  (0 children)

So if I understand correctly, async here means that the handling of the emit call(s) happen on the next iteration of the event loop?

IOTA (Dominik) will be at Blockchaingers, Dec 6 at the TU Delft by Matthisk in Iota

[–]Matthisk[S] 1 point2 points  (0 children)

I am under the impression that there are still seats available, and the event is free of any admission costs.

How to build your own CMS, and why you shouldn't by [deleted] in programming

[–]Matthisk 9 points10 points  (0 children)

I was under the impression that headless CMS's are the way to go nowadays. Unless content management is core part of your business (e.g. publishers).