-preview switches

Adam D. Ruppe destructionator at gmail.com
Wed Apr 1 18:32:19 UTC 2020


On Wednesday, 1 April 2020 at 18:21:46 UTC, Steven Schveighoffer 
wrote:
> What about when you have things like this:
>
> version(OSX) version = someFunkyVersion;
> version(Linux) version = someFunkyVersion;
>
> ///
> version(someFunkyVersion) void documentMe();
>
> does that display "someFunkyVersion" or version(OSX || Linux) 
> or something like that?

It'll say "someFunkyVersion", it keeps what's in the source. 
(that link there actually does just that - version(X11) is 
defined above as the default on version(linux)).

What I haven't done yet is auto-link those identifiers back to 
the original definition, so you can actually see it and any 
attached ddoc comment. But even without that, actually seeing 
what's in the source works a lot better than just skipping it 
entirely in the docs!

> A feature I'd like to see too (but please don't do it for just 
> me, as I don't use your docs at the moment), is to have version 
> filters at the top so you can see docs only relevant to your 
> platform. Should be pretty simple JS addition.

Oh perhaps, but given how complicated some of the this can be. 
Like does a filter on `someFunkyVersion` include OSX? Does one on 
OSX include it?

It is certainly possible, the language's feature-poor `version` 
thing is actually a kinda nice benefit here since it isn't too 
hard to recreate that logic and rebuild the chain in a doc script 
too.

But it is just all more than it looks at first glance.


More information about the Digitalmars-d mailing list