Discussion FST-1032 - F# analyzers and binary compat #508
Replies: 6 comments 18 replies
-
+1 source code distribution method. In general not just for Analyzers. Similar to the nuget references but maybe pointing it to a github, gist, or any webpage of your choosing. Thinking aloud for Part 1; Perhaps a binary format such as Protobuf? With the use of Span it should be incredibly fast. The representation could be used re-used for caching as well as dispatching to an out of process analyzer. |
Beta Was this translation helpful? Give feedback.
-
One thing that jumps out with this effort is the difficulty of using these analyzers in editor tooling that also supports the The compiler itself of course would not use this flag, but hosted compiler services would likely want to turn this flag on, but it is mutually exclusive with the How should this dichotomy be addressed by hosted tooling? Multiple FSharpCheckers that are kept in sync somehow? |
Beta Was this translation helpful? Give feedback.
-
Came across this tweet by Jared Parsons talking about diagnostics, and was wondering if we had the capacity to do similar in the current implementation. I can definitely see a benefit to making this information visible to end users via normal MSBuild reporting, and the binarylog is my go-to these days for diagnosing build issues. |
Beta Was this translation helpful? Give feedback.
-
I've been discussing with a few current Ionide Analyzer authors and there's a significant amount of support for altering the Ionide Analyzer API shape to be very similar to the proposed/implemented shape here, to make the migration path for this functionality much smoother as it gets closer to landing. The path would be something like:
|
Beta Was this translation helpful? Give feedback.
-
For start, I am sorry for invading an older and probably even closed discussion. INTRO
There would be solutions to overcome this at the cost of more complex FSC code and more stagnation, possibly also disabling certain refactoring/redesign options in the future. What is worse, even when binary compatibility could be maintained at some cost, semantic compatibility would be a lot harder due to tight coupling of tree traversal code at analyzer side. Imagine a scenario of a new language construct that would suddenly appear in the middle of the tree, let's pretend TryFinally would not exist before and was to be introduced. Older analyzers would not be capable of traversing into the child nodes of it, even though they could do useful work inside. Disclaimer: THOUGHT It is a good industry practice to decouple data used internally from the types shared with the outside via interfaces. At the same time, the interface description should be ideally an independent schema enable evolution of code/language used by both sides , and the data+operations driven by the needs of client ( => NOT being a 1:1 mapping between domain code used in the compiler and isomorphic DTOs, since this will eventually hit compat issues too). Thinking about an API to enable semantic compatibility for the analyzers and non-breaking ways of evolving compiler code at the same time, surprisingly a lot of similarities with DOM/XML and it's operations come to mind:
I obviously do know that xml is not the hottest technology of the day and defining the interface (data and querying operations) to be "XML-like, but fully developed and maintained by F# repo" would sound better, and API of Roslyn seems to be inspired that way too. At the same time, it is difficult to ignore the benefits of existing technologies around XML helping here (XML Schema, XPath, client-side generators/providers to work with semi-structured data ) and not having to write them from scratch. If analyzers are restricted to be used in-process, it could still be an in-memory object model without allocating the full xml document as a string. Given a few standard navigation operations, there is the potential to generate nodes for the interface lazily at the cost of a less generic (and less leaning on existing tools) approach. A more performant (conversion, allocations) and less known alternative could be protobuf v3 and it's field masks, but I do not consider it to be a technology wide-spread enough to base an API on. Also the simple JSON path used within it would very likely not deliver the desired semantic compatibility advantages. |
Beta Was this translation helpful? Give feedback.
-
I can't see configuration of analyzers being mentioned in the RFC. This is an important feature. For example, setting the cyclomatic complexity limit for an analyzer, or turning on and off arbitrary analyzers. There is some ongoing discussion of analyzer config in ionide/FSharp.Analyzers.SDK#8. |
Beta Was this translation helpful? Give feedback.
-
Discussion thread for this tooling RFC/discussion - https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1033-analyzers.md
Beta Was this translation helpful? Give feedback.
All reactions