fable-compiler / repl

Fable online REPL
http://fable.io/repl
MIT License
64 stars 38 forks source link

Packaging of REPL or make it more customizable. #185

Open kant2002 opened 1 year ago

kant2002 commented 1 year ago

I working on localization for REPL for my own needs. I plan to support couple languages which I can manage myself, and couple others based on Google Translate. Instead of working with patches, I interested into adding at least translation to this project. I think this is both improve REPL with relatively small amount of work to maintain and help me directly.

Because it's published currently under different domain I have to patch these lines

https://github.com/fable-compiler/repl/blob/081d22a29dc974f89f4fda2fe626cde0550dccd0/src/App/Prelude.fs#L13-L19

I don't really understand why not use Browser.Dom.window.location.href both for Debug and Release configurations.

Other options for customization which I would like to have is being able to specify list of additional assemblies here https://github.com/fable-compiler/repl/blob/081d22a29dc974f89f4fda2fe626cde0550dccd0/src/App/Prelude.fs#L29-L39

again, this is probably not big deal, but I think this may be valuable for REPL too.

So I really would like to hear what users and maintainers thinking about all these ideas.

MangelMaxime commented 1 year ago

I don't really understand why not use Browser.Dom.window.location.href both for Debug and Release configurations.

I don't remember for what we are using the HOST variable, but using window.location.href means that if the user clicked on the share button it will return something of the form https://fable.io/repl/#?code=DYUwLgBAHhC8ECIFA&html=Q&css=Q and not just the https://fable.io/repl/ portion.

So replacing with window.location.href all the time is probably not enough.

Regarding the additional assemblies, it is important to note that Fable REPL since Fable 3, only supports pure bindings. So it is not possible to use Fable libraries. Alfonso planned to re-add support for that in the past, but I don't think this has been done unfortunately.

And it also require the DLLs to be generated using a specific fork of the F# compiler. All that to say, that adding Fable libraries to the repl is not that easy currently unfortunately.

There are others issues discussing the ability to make Fable REPL a component or services like https://github.com/fable-compiler/repl/issues/70. Perhaps, there are ideas in them.

I am currently in the process of modernising Fable infrastructure to make it easier to contribute. The REPL is one of the element, I want to improve but unfortunately it is at the end of the chain right now...


Regarding, the possibility to add translation to the REPL we can consider doing it inside of this repository directly. We can do it in a naive way using a record to store the information.