(*---------------------------------------------------------------------------*) (* CodeDom F# generator *) (* (c) Tomas Petricek *) (* Send comments and bug reports to: tomas@tomasp.net *) (*---------------------------------------------------------------------------*) I currently tested generator only with ASP.NET, so currently only features used by ASP.NET are implemented and tested. If you have any other use for the generator, please let me know and I can try to implement currently missing featurs :-). KNOWN ISSUES: * ISSUE: INTERFACES & BASE CLASSES: - CodeDom contains base class together with all implemented interfaces so we have to find out what type is base class. The problem is that CodeDom doesn't know what base type is class and what is interface. Currently interfaces are recognized by name in format IAbcdefgh. - Interface implementation is not currently implemented (!!!!) * ISSUE: DELEGATES - While generating creation of delegate - in the following form: new EventHandler(fun a1 a2 -> this.Method(a1,a2)) generator need the number of parameters - this isn't available through CodeDom so it tries to find delgate type using Reflection (only standard libraries are searched, so you can't use custom delegate types) * WORKAROUNDS & HACKS - Static properties are generated instead of static fields (value is stored in global module generated for every class) - Properties are called using get_PropName - The code '((Array.zero_create 1).[0])' is generated instead of 'null' to allow null values for F# classes - When generating type cast that would look like following in C# '(SomeClass)a', generator doesn't know wheter it is upcast or downcast so it generates following ugly F# code: ((upcast (downcast a)):SomeClass) * #PRAGMA - #pragma directives are used to give some additional information to compiler in ASP.NET #pragmas are used to allow (easy) debuging of generated web Because #pragma is not supported in F# (AFAIK), the compiled assembly doesn't contain information about the source code (debuging of aspx files). To debug FS source file, you have to set breakpoint in ASP.NET Temporary generated files * OTHER - Some methods from ICodeGenerator are not yet implemented - GetBaseTypeOutput may not be fully correct - CodeBinaryOperatorExpression doesn't support Assign operator - Generics are not supported * LIMITATIONS OF THE F# LANGUAGE * '(?)' means that I'm not sure whether it is possible or not... - Nested classes not supported - Partial classes are not supported - #pragma not supported - (?) Chained constructors not supported: Cls() : this(a,b) {} - (?) Multidimensional arrays are not supported - (?) Types: Custom structs, enums and delegates are not supported - (?) Members: Events & type constructors not supported - (?) Parametrized properties not supported