Hi all,
This question is provocative a little-bi, I just want to raise discussion again about this topic …
Such “native” languages like Rust also sometime ago did not have a native threads, but after sometime they decided to add it, because “native” language that do not support native capability is strange …
Of course I like the approach that currently Kotlin Native has, because it is one of my most loved concurrency/parallel programming pattern Active Object, Actor and other names that it has …
But “native” capability is essential for Kotlin Native even if it is unsafe … To deal with unsafety you could add Thread class under kotlin.native.unsafe.Thread package …
Also adding Kotlin Native Thread class will allow to write wrapper Thread class kotlin.Thread that could be used across Java, Native and probably other platforms supported in future …
I do not thing that threading is universal across platforms. You can probably use POSIX threads for systems that support it.
3 Likes
What ?!
Then how C++ implement library ?
It is possible to create wrapper for each platform threads.
Also It will be possible have single wrapper around thread for all platforms Java/Native.
Why support Native threads ?! Because sometimes Actor pattern is not useful, for example for implementing parallel sorting Actor pattern has a big overhead. Implement parallel sort using native threads will work much faster !!
I do not thing I understand what you are trying to say, perhaps you can try asking in kotl.in/slack russian
channel or in Telegram: Contact @kotlin_lang in Russian.
1 Like
I am saying that sometimes it is not enough to have Actor pattern. Some concurrent algorithms requires to have low-level primitive like thread.
C++ already have library named thread that implements wrapper for each platform, it means that it is possible to have single wrapper around the “native” threads for each platform (Windows, Linux, Mac and etc.)