4 ms·
Yes, but I would have thought attributes were the canonical "think you might want to reflect over" rather than this imperative solution. But you're all happy wi
by thom 1y ago
Yes, but I would have thought attributes were the canonical "think you might want to reflect over" rather than this imperative solution. But you're all happy with it and it's not my circus, so enjoy.
- Kuinox 1y agoThis cannot be something you reflect over, because they allow to encode build arguments. They need to be parsed before it's compiled, which is exactly what preprocessors directive allows.
- thom 1y agoFair enough. Presumably I can query a script first somehow to see what the dependency tree is going to look like?
- Kuinox 1y agoWell for regular dotnet project there is `dotnet list` that allow that, I don't know how it will look c# script file, probably the same.
- WorldMaker 1y agoFrom what I've read of this preview `dotnet list` works as expected. Under the hood it supposedly builds a mini-project file so that most of the `dotnet` cli works as expected. It also provides an "eject button" to build the csproj from the script file `dotnet project convert`.
- lIl-IIIl 1y agoJava's annotations (which are mostly equivalent to C#'s attributes) can be consumed at compile time using annotation processors. If C# had this feature for attributes, could attributes have been used here?
- Kuinox 1y agoC# have this feature, it's called roslyn code generator. I believe your java annotations cannot change the build parameters of the package being currently compiled, which is why you wouldnt be able to do that in java. btw, anything that is present in the AST could be used for that, but I think the preprocessor directive is the most sensible choice.