Any thoughts on the applicability of Fable code to other languages like Python?
Unless Babel learns how to compile to Python, I don't think that some sort of .fs -> ??? -> .py path is quite relevant to Fable...
As such, this is likely close-able as-is.
Agreed Babel would not be used. This is a more general question about Fable: what parts of Fable would need to change to support another language?
It seems to me that much of it could be reused.
Hum I am not sure of the benefit as JavaScript is everywhere and so we can already use F# anywhere :)
Also, Fable generate codes optimize and thinked for JavaScript so I don't think there is that much to re-use except the global architecture of fable like:
And that's it
Actually there was a time when we entertained this idea and one of the original reasons to have an independent Fable AST was to make it easier to target languages other than JS. It's true that since then Fable has evolved always with JS in mind so I'm not sure how much could be recycled (probably the Replacements module would have to change a lot) but I do agree that it could be possible to reuse many parts of Fable as it is now.
However I've realized that a deep understanding of the target language and its ecosystem is necessary in order to build a practical compiler and not only a toy. This is a knowledge I lack for Python for example. Also, Fable (to JS) consumes all of my OSS budget so I don't think it's possible for me to extend it to other languages at the moment. But if someone would be willing to do that I'd be happy to provide support from Fable and eventually make it language agnostic if this has a good reception in the community.
It's worth to mention the Fez project to compile F# to Erlang. This one doesn't use Fable but I think the approach is similar.
You could always use ironpython pull in python dependencies for regular F# . I'm not sure how easy it is to go the other way.
@alfonsogarciacaro I don't think anyone on earth can rightly expect you to put in more time than you do. Also I think with any open source project it's important to protect the scope of your project. Someone else can create a fork with a broader scope that is a greater risk, but javascript imho is more useful than python, since there is no real way to run from javascript in the web. Javascript also is becoming a lingua franca due to babel.
https://github.com/PiotrDabkowski/Js2Py
SO you can always translate to javascript and then to python 馃挜
Excellent, thank you all for contributing to the discussion :+1: I will ponder these alternatives.
FYI: New effort started. See https://github.com/fable-compiler/Fable/issues/2339
Most helpful comment
FYI: New effort started. See https://github.com/fable-compiler/Fable/issues/2339