News for hackers. Stuff that matters.
Re:Fable: F# to JavaScript compiler by tpetricek on Sunday October 29, 2017 @05:43PM (#15581585)
This is a tricky one. If the abstractions were not leaky, you would not be able to interoperate with JavaScript libraries and you'd have to reimplement everything that powers the modern JS ecosystem. On the other hand, if the abstractions were too leaky, you'd lose all benefits of a nice language like F#.

I think Fable strikes the right balance. There are some leaky aspects of how it compiles to JS, but this means that you can quite well use it with existing JS libraries and for things like parsing JSON (you can just cast JSON object to F# records and it'll work).

So, you need to think about something about the JS part when you want to do JavaScript-y things, but you still get plenty of nice help from the F# compiler when writing the logic that the functional-first style makes so much easier.

In my experience with Fable, this pragmatic approach is what makes it great.

Re:Fable: F# to JavaScript compiler by microcolonel on Sunday October 29, 2017 @11:41PM (#15582970)
> you can just cast JSON object to F# records and it'll work

Isn't a "JSON object" just a string?

Re:Fable: F# to JavaScript compiler by TomMarius on Monday October 30, 2017 @04:25AM (#15583669)
He probably wanted to say "plain JS object", which is denoted in JSON. You can put JSON in a string, but the syntax is called JSON as well.
Re:Fable: F# to JavaScript compiler by tpetricek on Monday October 30, 2017 @08:14AM (#15584418)
Yes, that's what I meant, thanks :-). The idea is that you can just write `unbox<MyType>(jsonParse("{whatever:42}"))`.