Predefined Versions for Apple Operating Systems
xoxo
xororwr at gmail.com
Thu Jun 26 18:02:06 UTC 2025
On Thursday, 26 June 2025 at 17:03:33 UTC, Walter Bright wrote:
> > I'd never thought of that, I was just following normal C
> practice with the predefines.
>
> 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.
Most of the time, following C is a mistake, but in most cases,
it's okay (simplicity & efficiency).
It is obvious that following C is incorrect when it comes to OS
predefines.
In my view, `version (OS)` was a mistake.
1. Not type safe
2. Inconsistent
3. Prone to mistakes
D needs secure built-ins that are type-checked at COMPILE time.
```
static if (builtin.OS.tag == $Linux) {}
``
The benefit of using $ is that it eliminates the need to enforce
an import, prevents internal modules from being revealed, or just
eliminates the need to use the unsafe `version`.
By default, the most compelling and user-friendly code should be
the most secure.
It should be annoying to use something unsafe.
More information about the Digitalmars-d
mailing list