-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Backend naming #4246
Description
It has been bugging me for a long time that our backends are kinda wrongly named: They are named after the OS / platform that they target, instead of the API that they use.
This is a bit incorrect though, because a lot of APIs can be used on other platforms than their primary one. The most erregious case here is probably UIKit, which is used on three of Apple's platforms, mostly iOS, but increasingly visionOS and tvOS too. And with Mac Catalyst in recent times, it can even be used natively on macOS as well. Another example is that there exist projects like GNUStep that tries to bring AppKit to Linux platforms, and I think even Wayland can be used on macOS (?).
So many of the names in winit::platform::* are effectively false. I've tried to improve it a bit in #3756, but that only resolved the iOS/UIKit discrepancy - the Android backend, for example, should probably be called the NDK backend, as Android could technically run other backends as well (Wayland on Android any1?). Similarly, other platforms could target the NDK.
This becomes important now with #3433, since with that we'll kind of be locked into specific names (since we'll be releasing crates). So I've put this in the milestone to be figured out before the release.
See the table below for an overview of the naming scheme (with a few imaginary backends thrown in there for a broader context):
| OS/Platform | Backend / Actual API | Name after platform | Name after API |
|---|---|---|---|
| Android | NDK | winit-android |
winit-ndk |
| iOS/visionOS/tvOS/Mac Catalyst | UIKit / Cocoa Touch | winit-ios ? |
winit-uikit |
| macOS | AppKit / Cocoa | winit-macos |
winit-appkit |
| watchOS | WatchKit | winit-watchos |
winit-watchkit |
| Redox | Orbital | winit-redox |
winit-orbital |
| Many (predominantly unixes) | Wayland | ? | winit-wayland |
| Many (predominantly unixes) | X11 | ? | winit-x11 |
| Web | Web | winit-web |
winit-web |
| Windows | Win32 | winit-windows |
winit-win32 |
| Windows | WinRT | winit-windows |
winit-winrt |
| Many | GTK | ? | winit-gtk |
| All | Terminal | ? | winit-terminal |
| OpenHarmony / OHOS | ? | winit-ohos |
winit-? |
Only problem is, clearly "Android", "iOS" and "macOS" are more discoverable and understandable terms than "NDK", "UIKit" and "AppKit". So maybe favouring consistency and correctness here is the wrong choice?
For a bit of prior art, GLFW uses "Cocoa", "Win32", "X11" and "Wayland" (API names). The SDL uses "Android", "Cocoa", "Windows", "Wayland", "UIKit" (bit of both). raw-window-handle uses API names.