juselius / FsBiml

F# combinator library for BIML
MIT License
3 stars 1 forks source link

Make more type safe #1

Open jeremyhoughton opened 7 years ago

jeremyhoughton commented 7 years ago

This solution is a really good idea however at the moment it is easy to generate incorrect BIML even though the F# code compiles. It would be interesting to see whether the library could be improved so that incorrect BIML generation is caught at F# compile time.

eg. it is easy to accidentally write the following which should not be allowed in F#.


let biml =
    BIML [
        Packages [
            PackageAttr [Attr.Namespace "MyFirstFsBimlPakcage"] []
        ]
    ]
juselius commented 7 years ago

It is possible to make FsBIML more type safe, and enforce the BILM typing rules. The downside is that it makes things a good deal more complicated. And it's a fair amount of work, too. So I decided not to go down that path for now. It took me just an afternoon to code up the current version of FsBIML. But if more people request this feature, I might consider it when I find the time. A big additional upside would be improved IntelliSense support in VisualStudio, etc.

jeremyhoughton commented 7 years ago

Thanks for your reply. Out of interest do you know of any projects I could use to help me design and build a version that enforces the BIML typing rules implicit in the XML? I am really interested in trying to use F# to generate BIML as it is a lot nicer than BimlScript. One problem is that BimlScript has intellisense so I would really need to match that in F#/Visual Studio as this could be worked on by a number of developers so need to reduce the chance of errors.

juselius commented 7 years ago

I don't know of any other BIML related projects to get around the XML mess. I don't actually know much about BIML myself. I have never used it. I just hacked together F# bindings for my group to experiment with.