On Friday, 27 November 2015 at 07:08:40 UTC, Sönke Ludwig wrote:
Actually, no! Conditionals and loops are the only constructs -
switch is a possibility, but basically nothing else. There will
also never be variables, just constants. There is a definitive
limit, namely when it becomes impossible to reason about the
code in a generic way, without "executing" it, so in particular
anything that would make it touring complete is a no-go - no
recursion, no loop flow control statements, no goto. In fact,
there are no "statements" at all, these are all purely
declarative "directives".
I think conditions in msbuild are neat:
<PropertyGroup Condition="'$(StyleCopEnabled)' == ''">
<StyleCopEnabled>true</StyleCopEnabled>
</PropertyGroup>
You can make any tag conditional by adding a Condition attribute
to it without creating an additional nesting level. Though it has
condition grammar.
It has variables too:
<CreateItem
Include="@(Compile)"
Exclude="
%(Project.RootDir)%(Project.Directory)**\*Test.cs;
%(Project.RootDir)%(Project.Directory)**\*.Designer.cs">
<Output TaskParameter="Include" ItemName="StyleCopFiles"/>
</CreateItem>
This takes compiled files, removes unneeded ones and subsequently
the resulting files (StyleCopFiles) are fed to a style analyzer
tool.
Sure, JSON *works*, but it becomes really unpleasant with more
complicated files, and the whole {"comment": "..."} approach is
nothing but an ugly and highly inconvenient hack, both when
writing and when reading it.
Also in the dependencies map keys are package names so
{"comment": "..."} will be a dependency on a comment package.