I read the following article
http://studentguru.gr/b/kron/archive/2012/09/26/c-template-metaprogramming-and-f-type-providers.aspx
which shows a way to make Fibonacci compilation sequence generation times with F # type providers. The solution is in the article, but the final program
> cat .\fib.fs type fib = Playground.StaticFibonacci<100000> printfn "Fibonacci(100000) has %d digits" fib.Value.Length > fsc .\fib.fs -o fib.exe -r:.\FibonacciTypeProvider.dll βnologo > .\fib.exe Fibonacci(100000) has 20899 digits
This look is very powerful. I was wondering if it is possible to create a type provider for INPC (INotifyPropertyChanged) so that instead
open System.ComponentModel type MyObject() = let mutable propval = 0.0 let propertyChanged = Event<_, _>() interface INotifyPropertyChanged with [<clievent>] member x.PropertyChanged = propertyChanged.Publish member this.MyProperty with get() = propval and set(v) = propval <- v propertyChanged.Trigger(this, new PropertyChangedEventArgs("MyProperty"))
Perhaps you can write
open System.ComponentModel type MyObject() = let mutable propval = 0.0 let propertyChanged = Event<_, _>() interface INotifyPropertyChanged with [<clievent>] member x.PropertyChanged = propertyChanged.Publish member this.MyProperty : INPCTypeProvider<double>
So, before I spend half a day so that maybe someone even more informed can tell me that I am wasting my time and this level of metaprograms is simply impossible.
source share