Predefined Versions for Apple Operating Systems
Hipreme
msnmancini at hotmail.com
Sun Jun 29 15:46:19 UTC 2025
On Saturday, 28 June 2025 at 12:04:36 UTC, Ogi wrote:
> On Thursday, 26 June 2025 at 17:03:33 UTC, Walter Bright wrote:
>> Your idea is a good one, but I think it's a bit too late. I'm
>> concerned about the disruption it could cause. People with a
>> lot of code just don't care for even simple changes like
>> search/replace. We've inflicted enough of that.
>
> How about a Phobos module that wraps version identifiers in a
> type-safe manner?
>
> Draft:
> https://gist.github.com/Ogi-kun/3946759f86ef03ba59dacc81cd6e63e6
>
> ```D
> import std.config;
>
> static if (isPosix) {
> /*...*/
> }
> else static if (platform == Platform.windows) {
> /*...*/
> }
> else static assert(0, "Unsupported platform");
>
> static if (arch == Arch.x86) {
> static if (pointerWidth == P64) {
> /*...*/
> }
> else static if (pointerWidth == P32) {
> /*...*/
> }
> else static assert(0, "This CPU does not exist");
> }
> else static assert(0, "Unsupported architecture");
>
> ```
We already have quite a bit of that inside `std.system`.
You can get the operating system and architecture the user is in
by using `std.system.os` and instructionSetArchitecture
More information about the Digitalmars-d
mailing list