dotnet-websharper / core

WebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
https://websharper.com
Apache License 2.0
595 stars 50 forks source link

More granular DCE around union cases #1323

Open Jand42 opened 1 year ago

Jand42 commented 1 year ago

Union cases are one area where DCE could be improved. At the least, no union case constructor for unused cases.

Far more tricky would be is to actually trim match expressions that cleanly match union cases too, and track their dependencies separately, so even more code can be eliminated around unused cases. If this could happen, we would not need things like the refactoring we made around UI templating to avoid pulling in MathJS when not needed - we had to convert a union to an abstract class, and all matches on it into abstract methods so that code belonging to "cases" (now subtypes) can be cleanly cut out by current DCE that works at method level only