Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the WebSharper compiler to write Node.js applications [closed]

I was wondering if it is possible to use the WebSharper compiler to write Node.js applications in F#. Are there any resources available that could show me how to do this? Are there any good reasons not to try to do this?

like image 559
mushroom Avatar asked Dec 27 '22 17:12

mushroom


1 Answers

[I would post this as a comment, but it got a bit too long...]

Here is another good reason not to do it - F# agents and asynchronous workflows provide a concurrent programming model that is in many aspects much better than what Node.js provides. For example:

  • it gives you both concurrency and also true parallelism so you can write code that does not block the system when it needs to do some work using the CPU
  • asynchronous workflows provide easy way to handle exceptions and handle resources
    (you can use try .. with in asynchronous (or event-based) code)
  • the agent-based programming model gives you a great way to store state

If you can use F# to write your server-side application, then you can as well us the powerful abstractions it providers. See Server-Side Functional Programming for a brief introduction. I also did a talk F# on the server-side which has been recorded and discusses the same topic.

This is not necessarily a reason why not to try this. Trying this might be fun and if you like F# language, but want to use in Node.js environment, then it would be very useful to have this.

like image 70
Tomas Petricek Avatar answered Dec 29 '22 06:12

Tomas Petricek