Frequently Asked Questions

What is the main advantage of WebSharper™?
It is the ability to develop mutli-tier web apps in a single layer in an advanced statically typed language (F#), providing a shorter time to market.
Do not compilers targeting JavaScript already exist?
Yes, this technology is becoming prominent For instance, the Google Web Toolkit (GWT) allows developers to write Java code and translates that to JavaScript. Similar tools exist for C# under .NET.

The advantage of WebSharper™ over these systems is its reliance on F# as the source language. F# provides static typing with type inference and metaprogramming facilities that allow for programming idioms that are impossible or impractical to express in a more traditional language like Java or C#. One example is the Formlet abstraction that is structured as an applicative functor.
Why F#?
As a hybrid functional/object-oriented language, F# is a good match for compiling to JavaScript. It is also a formidable language on its own.It was built from ground-up to provide smooth accessibility to the inheretnly object-oriented .NET infrastructure, and yet maintaining clean, functional constructs and abstractions. It allows for unrivaled productivity and concise, easy-to-maintain code.
What is the main difference between WebSharper™ and other web development frameworks such as ASP.NET?
While conventional web technologies such as PHP or ASP.NET are server-based, meaning that the web server is actively involved in rendering the pages and passing them to the client to display, WebSharper™ is inherently client-based. You program with the client in mind, doing display logic and occasionally calling the server for data or processing user input. To the client this means a more responsive, rich experience, and to the developer - an easy to understand and uniform environment.
Besides being an F#-to-JavaScript translator, what does WebSharper™ provide?
WebSharper™ includes a port of a subset of F# and .NET standard libraries to the client, and a number of bindings to third-party JavaScript libraries. It also provides infrastructure tools for building and deploying generated applications.
What are WebSharper™ Formlets?
Formlets are a library of combinators for building composable web forms. Forms are key elements in any web application, as they gather input from the users. Unlike their ASP.NET counterparts, WebSharper™ forms run and validate on the client, submitting their result to a either a client- or a server-side callback. In addition, Formlets are typed, following a design presented in Cooper et al (Ezra Cooper, Sam Lindley, Philip Wadler, and Jeremy Yallop. "An idiom's guide to formlets." Technical report, University of Edinburgh, 2008). Formlet construction is therefore a straightforward procedure requiring no ugly casts or manual identifier management.
What about WebSharper™'s page concept?
WebSharper™ applications are build from composable pagelets (and formlets, their special case), all written in F# code. While you can embed WebSharper™ pagelets or formlets into ASPX markup using the WebSharper™ ASP.NET integration features, you can also request pages within your web application using custom URLs that are part of your pagelet or formlet specification. The WebSharper™ web server extensions make it possible to fetch and render these resources automatically without having to resort to ASPX markup.
What makes WebSharper™ easy to work with?
WebSharper™ comes fully integrated into Visual Studio, you not only get a new project type for WebSharper™ web applications, but you also get enhanced build and verification support to ensure that your generated JavaScript code is semantically correct.
Isn't semantic correctness guaranteed by the F# compiler?
The type system is not expressing all the assumptions made in WebSharper™, but those are still checked at compile time by running an external verifier tool on the F#-generated assembly. At this stage code is checked for proper modality of operation, making sure that you only call functions from the client that are available for you to call. For instance, you can only call server functions that are marked as callable (for security reasons), marked as JavaScript, or mapped to JavaScript as extern, inline or macro prodecures.