-preview switches

Steven Schveighoffer schveiguy at gmail.com
Wed Apr 1 18:41:37 UTC 2020


On 4/1/20 2:32 PM, Adam D. Ruppe wrote:
> 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)).

Yeah, I suppose that's still more useful than nothing.

>> 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.

My expectation is that you would provide the list of versions to "turn 
on or off", and then use that data to determine when symbols are 
present. These would probably just be the OS versions I would think. 
Semantic processing on the version statements should be pretty 
straightforward since they are so limited.

-Steve


More information about the Digitalmars-d mailing list