-
-
Notifications
You must be signed in to change notification settings - Fork 251
Playground output result #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playground output result #420
Conversation
…g.org into playground-ouput-result
I've also created a constraint that the module |
Nice, would be interested to hear about the trade offs between iframe vs worker execution!
I don't know if you would want to execute the code as you type - I haven't used a REPL/playground that works like this. I was basing the UX in my PR off of the TypeScript playground. Added a "Run" button next to format and was planning to allow Ctrl+Return for running too. |
I followed the svelte-repl approach which uses both background workers and iframe. The thing is that the background worker should be used to compile and bundle. After that, you send the code to be evaluated inside the iframe as I did. Since we're not bundling multiple files as in Svelte's and the compiler is already handled, I focused on the logic to evaluate code and make sure it executes. Thanks for the suggestion @tom-sherman. Indeed executing as the user types may not be a good approach. |
let codeFromResult = (result: FinalResult.t): string => { | ||
open Api | ||
switch result { | ||
| FinalResult.Comp(comp) => | ||
switch comp { | ||
| CompilationResult.Success({js_code}) => js_code | ||
| UnexpectedError(_) | ||
| Unknown(_, _) | ||
| Fail(_) => "/* No JS code generated */" | ||
} | ||
| Nothing | ||
| Conv(_) => "/* No JS code generated */" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this from the Output Panel in order to re-use it here.
Thanks for the effort! just tried it and it broke with the following error after i ran the program, edit some code, and re-ran it:
I'd need some more time to play around with the code and verify a few things. I am mostly interested in the maintainability / bundle size / UI UX aspect. My original vision was to go with @tom-sherman's approach of just executing the code without any rendering, just to keep things simple. The HTML / React rendering would have probably been the next step I guess. Let's see |
@ryyppy thank you for the answer! Can you send me the code you used to break the app? |
Literally the example that loads in the beginning. |
…g.org into playground-ouput-result
@ryyppy sorry for the delay, it's been a busy month. I've managed to fix the error and would appreciate it if you could play around with it. I see it as a next step moving some parts to separate workers. Also did some renaming trying to make things clearer. |
Hey @ryyppy, this PR seems like it got abandoned and was a good improvement over the current status. Is there anything we could help in merging this? Creating a bundle with Stdlib exposed into window sounds doable inside the rescript-lang.org repo, should it live here or have another repo for it? cc @diogomqbm |
Hey @davesnx, I've been meaning to get back to this.
I'll do a little clean up here and I think we'll need an official bundle of the std lib. Besides that, we'll be good to go once the UI/UX is approved. |
@diogomqbm I just gave this another look and I feel more comfortable pushing this forward. Any chance you could rebase onto latest master (maybe together with @aspeddro)? Regarding usability there are a few things:
|
this got merged in #875 🎉 |
Description
eval
and postMessage API.Caml
,Curry
,Std
, andJs
toglobal.window
. This bundle is served using a bucket just for testing purposes.React
,ReactDOM
, and the values above mentioned inglobal.window
.I've been doing this for a while and forgot to upload it here. After I saw #415, I thought that we can join forces to finish this task.
🚨 Attention 🚨
In order to merge this, we should create an official bundle where we make the standard library available globally. Then, we should change it here.
Closes #414
cc @tom-sherman @ryyppy