Atomics

I don't want to sidetrack this thread too much on the topic, and I'm happy to start a new thread if there's lots to say on the topic, but I want to address this future direction since it's been mentioned a few times now. This style of compile time query has come up in the past and it seems like it would be pretty useful feature for many reasons. The conclusion of those threads was that although this would be an intuitive syntax, it seems infeasible to support generic compile time queries for the presence of a declaration because it implies a cycle between parsing and semantic analysis (resolution of the name in the query requires semantic analysis, which requires parsing, which would need to resolve these conditionals ♲). Perhaps it's simpler if the queries were restricted to type names, but I'd prefer a more general solution. An alternative way to get this kind of functionality that I've been thinking about would be to allow modules to declare compile time feature flags for clients to test. The flags should be explicitly designed to resolvable unambiguously by the module loader during parsing, side stepping a need for semantic analysis.

6 Likes