OS2 interoperability #6010
Closed
RySah
started this conversation in
Ideas/Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think there's a big issue with interoperability between
os2andos, specificallyos2.Fileandos.Handle, where other core packages e.g.terminalhas no support for theos2package. I think there should be some interoperability provided between the 2 packages in the API ofos2at least until we've perhaps completely migrated toos2.From what i've seen in
os2andos, a simple function like this should work:os.Handleon my version of odin (dev-2025-12-nightly:ac61f08), is simply an file descriptor/handle with no other metadata. Meaning by simply capturing the file descriptor/handle from theos2.Fileand casting it as anos.Handle, it should technically work.I think this function could help indicate to developers who may not understand the differences between the 2 packages, that their code primarily using
os2can still use code primarily targeting theospackage. I definitely see this practice being considered unsafe, seeing as the wayos.Handleandos2.Fileare managed in memory are different, but it can help produce far more efficient code than the routes some developers may mistakenly take e.g:Could more efficiently become:
Additional Notes:
as_unsafe_os_handlehas went under a very simple test ofassert(as_unsafe_os_handle(os2.stdout) == os.stdout)Beta Was this translation helpful? Give feedback.
All reactions