Skip to content

std: Move some terminal-related wrappers to winlean#25766

Open
ZoomRmc wants to merge 1 commit intonim-lang:develfrom
ZoomRmc:zwinlean
Open

std: Move some terminal-related wrappers to winlean#25766
ZoomRmc wants to merge 1 commit intonim-lang:develfrom
ZoomRmc:zwinlean

Conversation

@ZoomRmc
Copy link
Copy Markdown
Contributor

@ZoomRmc ZoomRmc commented Apr 24, 2026

duplicateHandle and DUPLICATE_SAME_ACCESS were already in winlean, other stuff moved.

Since std already uses them in terminal privately, makes sense to move them and export.

Almost every library/app concerned with terminal handling rewraps these:

`duplicateHandle` and `DUPLICATE_SAME_ACCESS` were already in winlean,
other stuff moved.
@Araq
Copy link
Copy Markdown
Member

Araq commented Apr 24, 2026

I also wanted the symlink-handling to go into the other direction, symlink-specific Windows declarations should move to its module. (Also once the CI is green, the symlink PR will be merged, sorry for my resistance, I did more research and I learned that other stdlibs also do in fact deal with this nonsense...)

@ZoomRmc
Copy link
Copy Markdown
Contributor Author

ZoomRmc commented Apr 24, 2026

It's not an easy question. winlean is special since not all PLs offer such an easy C FFI, and is already kind of a kitchen-sink module, so the precedence is already set.

In this case, again, the procs are already in stdlib, just not exported, but they are consistently used by other libs that already import winlean anyway, so offering them publicly is logical and doesn't bring anything new (and thus possibly problematic) into the library.

Also, moving stuff to their modules privately leads to code duplication, such as two instances discovered with this PR. Localizing wrappers guarantees a stable and interdependent API, and simplifies possible later changes, like changing DWORD to uint32 and WINBOOL to uint8 finally ;).

Appreciate your symlink comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants