SHARE
TWEET

Untitled

a guest Jan 27th, 2013 59 Never
  1. Giving a good answer to this question (from the F# perspective) is not really possible. F# provides a number of mechanisms that you can use to mainpulate with types and you would choose one of them depending on the use.
  2.  
  3. I can _theoretically_ understand what you mean by "first-class types", but that is a view from a different perspective than the one used in F# - so F# has several concepts that might fit, but no single concept will work in all cases.
  4.  
  5.  * .NET Reflection (demonstrated by other answers) lets you generate real .NET types that have properties, methods etc. This is used mainly by mocking libraries (for testing) or by compilers of dynamic languages, but it is not needed for normal end-user programming.
  6.  
  7.  * F# type providers (see [MSDN][1]) let you generate type before compilation of the main program. The types can be used to access databases or other data (XML, CSV, JSON) or external data sources. The [F# Data library][2] should be a good example.
  8.  
  9.  
  10.   [1]: http://msdn.microsoft.com/en-us/library/hh156509.aspx
  11.   [2]: http://tpetricek.github.com/FSharp.Data/
RAW Paste Data
Top