Replies: 4 comments 6 replies
-
As mentioned above in the discussion - I think we should likely hide the representation of the major SyntaxTree types (especially SynExpr, SynType) and make FCS users use active patterns to access these. We've used this technique for F# quotations (FSharp.Core) and FSharpExpr (FCS) and it's allowed both to basically be binary compatible (or non-breaking for FSharpExpr) over many years of progressive updates. There is a slight performance cost to doing this (extra wrapper allocation objects on traversal) but there are techniques to minimise these and we could consider some further language work if it's a huge problem (I honestly don't expect it will be - there are already many allocations in most of our traversals, and the most important ones are internalised anyway and can use the internal access to the discriminated unions). |
Beta Was this translation helpful? Give feedback.
-
Just in case, we use SyntaxTree a lot and heavily depend on its representation details. Please, if making a stable abstraction over it, move it to a namespace that isn't considered a stable API and don't make it internal. |
Beta Was this translation helpful? Give feedback.
-
@dsyme @cartermp I think it's worth it having dedicated design discussion session(s) with community eventually, where we can collect feedback and talk about the changes we plan. What do you think? |
Beta Was this translation helpful? Give feedback.
-
PRs #10756 and #10772 have done a lot of work to remove the "stuff that should never have been public" from FSharp.Compiler.Service.dll, down to about 40% of the previous surface area.
I'd like to now for us all collectively do a design review on the remaining surface area. There is no huge rush with this and this is an open discussion thread which I'll contribute to as we go
The remaining surface area is shown in:
the generated surface area baseline file (NOTE: if you're reading this before Further work on FCS API #10772 goes in then look here instead).
The various signature files
The public surface area is currently in these namespaces:
There is now essentially nothing public directly in FSharp.Compiler.*
My overall aim so far has been to get to the point were we can start an intentional community design process of looking at the remaining public contents and deciding what we want to do with renaming, organising into namespaces, deprecating etc. We can compare with Roslyn too.
One thing to note is that the design is fairly "first order" - there are relatively few public interfaces and relatively few hooks, and those that are don't have very complex or open semantics. This is important for lots of reasons.
By far the most brittle part of the design is SyntaxTree. This is because it is a big discriminated union. We should consider internalising the representation of these types and have FCS users match them with active patterns instead. This is a big but routine thing to implement.
Open discussion below. I'll edit this head issue or an RFC as decisions get made.
Beta Was this translation helpful? Give feedback.
All reactions