Subject: Experiment - Compiler directives
This is another thought experiment to get feedback on the syntactic possibilities of VF.

Almost all modern languages have a means of controlling how code gets parsed at compile-time. This usually involves defining constants, testing these constants for a particular value (or just their existence), and possibly generating code or aborting a compile.

VF, so far, can parse the following directives:
  • @define constant - defines a constant
  • @if constant - compiles the following code if constant is defined
  • @elseif constant - when the preceding @if failed, tests alternative constants
  • @else - when all preceding @if and @elseif fail, compile the following
  • @endif - ends a conditional

Subject: Re: Experiment - Compiler directives
Conditional compilation is very useful, so debugging information can be omitted for the release compilation for instance.

I like that addition.

Subject: Re: Experiment - Compiler directives
My plan for now is to allow some simple logical operations: And, Or, Not.
Code:
@if Windows
' Windows-specific thing
@if Win64
' Win64-specific thing
@endif
@elseif Linux or MacOS
' *nix-specific thing
@if Linux
' Linux-specific thing
@if not Ubuntu and not Fedora
' Non-Ubuntu/Fedora-specific thing
@endif
@elseif MacOS
' MacOS-specific thing
@endif
@endif

Subject: Re: Experiment - Compiler directives
That makes sense too, so specifying a constant for the path separator or path list delimiter would be easy.


Page 1 of 1


Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Full Version
Powered by phpBB © phpBB Group
Design by phpBBXS.Com | Lo-Fi Mod.