C11 added _Generic to language, but turns out metaprogramming by inhumanely abusing the preporcessor is possible even in pure C99: meet Metalang99 library.
I'm actually working on a library doing just that! It's still in very (very) early development, but maybe someone may find it to be interesting. [1]
Link [2] is the implementation of a vector. Link [3] is a test file implementing a vector of strings.
The downvotes make me laugh, I did something pretty similar not long after the _Generic keyword came out and remember getting a pretty icy reception even though I was pretty up front about how painful and crufty it is.
The fundamental difference is the C preprocessor is actually a language independent of C. They follow their own grammars, syntax, semantics, symbol tables, etc., and do not communicate with each other.
So if we know Symbol.dispose in advance we can simplify the code? Why did they make it so unwieldy especially since it is a new functionality not requiring backwards compatibility hacks?
> So if we know Symbol.dispose in advance we can simplify the code?
Symbol.dispose is Symbol.dispose. It's a singleton object and that's the sole reference to it.
> Why did they make it so unwieldy especially since it is a new functionality not requiring backwards compatibility hacks?
1. Bare names in object keys are strings, so there needs to be an "escaping" syntax for non-string keys, that is what the brackets have done since 2015, in order to support the addition of...
2. Non-conflicting keys, which are what symbols are: symbols are guaranteed not to conflict with any string, and even to be unique unless they're created using `Symbol.for` (which accesses and stores into a global registry, this allows adding protocol methods to all objects without the risk of breaking existing any (by triggering new and unexpected behaviour).
> So if we know Symbol.dispose in advance we can simplify the code?
Symbol.dispose is not a string, but a symbol. Its value cannot be written out in the code, only referred to indirectly (that is basically what symbols are for), nor is there special syntax for properties with symbol keys like there is for properties with string keys, because that would be a nonsensical proposition due to the aforementioned fact. Thus, you cannot just write the property name directly, you have to use the computed property name syntax: [Symbol.dispose].
Depending on the model, the camera might be physically disabled when the lid closes. [1]
In general, if you don't trust a device one hundred percent, you shouldn't use it anyway. You have no way of knowing whether or not your company enabled the root user and added some shady, untraceable-to-you software prior to giving you the device. Also, Apple MDM software is zero-configuration, so they wouldn't even have to open the box. [2]
Why not just ask your employer what kind of tracking they do, though? I would totally understand them tracking the location of the device for insurance reasons, as long as they are transparant about it. It's still company property. "Listening" to the microphone seems a major breach of privacy whether you're at work or at home, and I'm sure your local laws prevent you against that kind of corporate behavior. Also, who would want to work for a company that does that, anyway?
I'd just use my personal device for personal stuff.
Link [2] is the implementation of a vector. Link [3] is a test file implementing a vector of strings.
[1]: https://github.com/jenspots/libwheel
[2]: https://github.com/jenspots/libwheel/blob/main/include/wheel...
[3]: https://github.com/jenspots/libwheel/blob/main/tests/impl/st...