fable-compiler / repl-legacy

http://fable.io/repl
MIT License
14 stars 10 forks source link

Noob question here: How does the whole thing work? #19

Closed whitetigle closed 6 years ago

whitetigle commented 6 years ago

Hi, I've started to read the doc of the FCS and the code of the fable-repl, but I fail to see how the whole system works. So would you be kind enough to explain to a noob like me how it works in a few lines?

In the case of the Repl, if the service would be hosted somewhere on a powerful server, does it mean, we could use a low end chromebook to build apps from the browser?

I ask you that because I had this idea yesterday so I tried. But on my chromebook it's quite unresponsive /very slow. It takes about 3-5 secs to update the render (compilation+transpiler I think).

Thanks!

ncave commented 6 years ago

@whitetigle It's quite the opposite I'm afraid, it's a static website so the server just serves the files, nothing powerful needed there. It's the browser, your client machine, that needs to be beefy, since the REPL javascript is not (yet) optimized (about 10x slower than the dotnet version of Fable).

ncave commented 6 years ago

@whitetigle As to how it works, it's basically Fable compiled with Fable. One of Fable's dependencies is FCS, where the F# AST parsing, typechecking and autocomplete comes from. FCS needs all the referenced dotnet framework assemblies to check the types, so it loads them the first time (cached in the browser after that). Then Fable converts the F# AST to Babel AST, and the rest is history.

whitetigle commented 6 years ago

Thanks @ncave. It's all very clear now 👍

alfonsogarciacaro commented 6 years ago

Yes, it's running everything in the browser now... so we don't have to pay fees to any cloud provider ;) This also makes it possible to develop in a Chromebook which is great (though very limiting atm cause we don't have libraries nor multiple files). I want to move the compiler to a web worker, hopefully that helps a bit improve performance.