Live data from Hacker News

Fable: F# to JavaScript compiler

fable.io

51–60 of 74 posts

Re: Fable: F# to JavaScript compiler

#51

Earlier quoted context omitted.

Fable is a compiler and runtime for a language that already very much exists, and has its own documentation and landing page. F# isn't a new thing.

Sure, but I would still like to see how I would use this in the context of a browser. How do I interact with existing JS libraries? How would I use it with React or something else? How would I even call window.alert()?

For React, install the appropriate library[1] and then call the functions you need from the Fable.Helpers.React.* namespace. If you want to see a complete implementation of Fable + React in action, the canonical example is https://github.com/SAFE-Stack/SAFE-BookStore

For alert(), you'll find it in Fable.Import.Browser.window.alert()

(In case you're wondering, the Fable convention is that the Fable.Import.* namespace is used for pure JS bindings with no business code, while libraries with an actual translation layer are placed in the Fable.Helpers.* namespace.)

[1] https://www.nuget.org/packages/Fable.React/

Re: Fable: F# to JavaScript compiler

#52

Earlier quoted context omitted.

> you can just cast JSON object to F# records and it'll work Isn't a "JSON object" just a string?

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.

Yes, that's what I meant, thanks :-). The idea is that you can just write `unbox(jsonParse("{whatever:42}"))`.

Re: Fable: F# to JavaScript compiler

#53
post #39

Earlier quoted context omitted.

That would require Microsoft, the F# team, and the vocal F# community members to actually want F# to be a proper first-class .NET citizen, which sadly isn't the case. https://np.reddit.com/r/fsharp/comments/6tdrwq/after_so_many...

Mads Torgerson (the head of the Roslyn project; C#/VB Compiler) showed once a slide, that c# devs are counted in millions, VB devs in 100k steps and F# devs in 10k steps. F# is a wonderful thing for the ecosystem, but practically of no importance regards priorities. IMHO: To make UWP and F# a thing, UWP need to be remodeled to a primary react like system. That however will never be a story, considering the state driv…

So when they purposefully dismiss F# and say it's just useful for scientific and engineering (with a touch of finance) they find they don't get much adoption from general business developers?

F#, even if used as a better C#, is still a win. C# has improved a ton since F# appeared, but it's still clunky. Microsoft should have had a push, F# for everyone, but this is the company that had to be dragged into generics (by the F# people) so I don't know what we'd expect.

All F# needs is real committment to level tooling. Instead it's an afterthought. It's enough to give even me pause when starting a project.

Re: Fable: F# to JavaScript compiler

#54
post #35

Why not show a code sample on the homepage? None of Home, Docs, or Samples have a single code snippet on the entire page, you have to click through. Crystal and Rust are good examples of language homepages that give you an idea of what you're getting into up front. Or for a transpiled language, PureScript.

you can go to the samples... but you will quickly notice a lot of the samples are canvas orineted things, because Fable gets to be in control to do things F# like. There's a vue and react example, but the code doesn't show any real advantage. Very little examples of typical web pages.... just a link to fable-elmish..... so... you may as well use elm. This is a common problem for F# in general, it hasn't really carved…

Hi, fable-elmish author here. Elm is great if you don't care about investing into two ecosystems or don't have a backend, or don't have a Native client in addition to Web, or don't care about what JS ecosystem has to offer.

Fable lets one use F# for both frontend and backend, and being able to share the code (models in particular, but really anything) while maintaining clear separation of tiers reduces your code base and dramatically improves quality w/o the need for elaborate tests.

Fable-elmish lets one use the same frontend code and architecture to write Native and Web apps. Again, YMMV, but at our company being able to transition an entire team between completely different types of projects avoids expertise silos and makes truly cross-functional teams possible.

We have OSSed a lot of our backend tech that helps building event-driven system in F# as well, in case anyone's interested: https://prolucid.github.io.

As Tomas said, just like Lisp in Paul Graham's "Beating the Averages" has been his secret weapon, F# is ours.

Re: Fable: F# to JavaScript compiler

#55
post #6
post #4

Earlier quoted context omitted.

some people said in the Reason3 update article that F# is better suited for JS devs than OCaml.

i saw somewhere an article mentioning "why don't more people write f#" (mebbe it was on h/n)? I have never had to really worry about concurrency and if you've got a good familiarity with C#, you're halfway there to being a very productive in TypeScript, so I don't see exactly where F# fits in, considering the best parts of C# are its functional bits.

You might find this an interesting read about C#/F#: https://fsharpforfunandprofit.com/posts/is-your-language-unr...

Re: Fable: F# to JavaScript compiler

#56
post #43

Earlier quoted context omitted.

> there is no sign of UWP going away anytime soon Except for Windows Phone getting killed, which was the _main_ device type for UWP. The Windows app store is the same graveyard that it was in late 2015 when the announcements around new Windows Phones piqued my curiosity. It looks like that's simply not a thing anymore. I'm betting my money on Xamarin and the browser for a client application, not UWP. There's just no…

UWP is the future of Windows APIs, in case you missed Windows Developer day earlier this month. So if F# doesn't speak UWP, the community keeps tweeting that GNU/Linux is so much better than Windows, and that we enterprise devs just don't get it, should we bet which of those technologies will last longer on MS roadmap?

My F# code runs on Linux. My client code is migrating to the web and mobile, as is just about every enterprise in the US. Why would I watch Windows developer day?

Re: Fable: F# to JavaScript compiler

#57
post #41

Earlier quoted context omitted.

As a sometimes-user of F#, I’m quite happy not caring about a dead-end technology like UWP and .NET Native, thank you very much. I’m glad everyone else seems to agree about that, too.

How things are going, I bet those dead-end technologies have a brighter future than F#, specially when I see those Microsoft bashing comments. If it comes to be, lets see how long F# survives without Microsoft support.

Microsoft bashing? Where did I do that?

I run a few things on .NET Core today and it’s great. I’ll probably runs some things in Azure soon enough. I just think UWP has no future because its primary device type (Windows phone) is dead, and it hasn’t seen any uptake in the enterprise to replace Winforms and WPF. F# seems just fine to me, and it’s supported for my app type. Perhaps you need to rethink your choices in development technologies.

Re: Fable: F# to JavaScript compiler

#58
post #41

Earlier quoted context omitted.

How things are going, I bet those dead-end technologies have a brighter future than F#, specially when I see those Microsoft bashing comments. If it comes to be, lets see how long F# survives without Microsoft support.

Microsoft bashing? Where did I do that? I run a few things on .NET Core today and it’s great. I’ll probably runs some things in Azure soon enough. I just think UWP has no future because its primary device type (Windows phone) is dead, and it hasn’t seen any uptake in the enterprise to replace Winforms and WPF. F# seems just fine to me, and it’s supported for my app type. Perhaps you need to rethink your choices in de…

As was stated before, UWPs primary device type is every Windows 10 device.

https://np.reddit.com/r/Windows10/comments/75lgti/announcing...

You don't seem to understand what UWP is about.

Re: Fable: F# to JavaScript compiler

#60
post #4
post #3

great! now we just need more than two people that know f#. i keed...kinda ;)

some people said in the Reason3 update article that F# is better suited for JS devs than OCaml.

Ocaml is the worst variant of ML in my opinion. Like usual, programmers always seem intent on making the worst option the biggest one (seriously, SML syntax is better than Ocaml syntax in almost every way).
Post reply on HN