Hide this comment

Now the question is how to make this extension portable across different/future versions of F#.

By on 12/14/2011 2:27 PM ()Reply
Hide this comment

My latest thought on implementing higher-order modules in an ML-like fashion can be found here.

By on 12/10/2011 6:32 AM ()Reply
Hide this comment

One obvious idea would be implementing further metaprogramming capabilities, say defining macros for dealing with external DSL syntax. Although the string to string nature of macros is definitely a limiting factor, this could make some intriguing use of DSLs.

Here is a slightly contrived example using an imaginary graph DSL called "Neureka" (inspired by some earlier work from a long time ago):

1
2
3
4
5
6
7
8
9
10
11
let G = LoadDirectedWeightedGraphFromFile @"..."
let C1, C2 = RandomNodeFrom G, RandomNodeFrom G

let pathFromC1ToC2 =
   Neureka {{
      find Path in G(V, E) where
      first(Path)=C1 and last(Path)=C2
      and Path is valid in G(V, E)
      and cost(Path) is minimized
   }}
...
By on 12/9/2011 2:54 PM ()Reply
Hide this comment

You could easily create a base macro which does basic preliminary lexing, calls another sub-macro with the token list, gets back an AST (even F# quotations) then prints them to text.

The advantage of text-to-text is that it adds the possibility for text-macros and allows different macros to be written with a different lexer/AST pair, because different macros would need different features.

By on 12/9/2011 11:07 PM ()Reply
Hide this comment

The number one thing I'd like to use them for is as a faster replacement for Reflection. For example, one common thing we do for serialization is recursively reflect over a record tree and fill it in from a file. Would be great if we could generate the mechanics of this at runtime instead.

By on 12/7/2011 1:40 PM ()Reply
Hide this comment
  • Lenses
  • Links-like formlets (example). It looks like XML literals but desugaring it is actually much more complex. Links has a version of this implemented with camlp4, which I started translating to a Nemerle macro but never finished :(
By on 12/7/2011 1:00 PM ()Reply
Hide this comment

Forgot the lenses! Knew I should have went over the email logs :)

Will look into Links, seems pretty cool on the first glance, though I think it should be pretty much designed from scratch to fit the "F# feel". Yesod and WebSharper both shared some characteristics with Links.

By on 12/7/2011 1:17 PM ()Reply
Hide this comment

I don't know about any other web library/framework with formlets sugar. Not even Yesod has it AFAIK (see how the formlet is defined separately from HTML/Hamlet in this example using just regular applicative functor operators).
An F# macro providing syntax sugar for formlets could desugar either into WebSharper formlets or FsFormlets

By on 12/7/2011 1:47 PM ()Reply
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper

Logging in...