Skip to content
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

A great project! #19

Closed
hatemhosny opened this issue Feb 6, 2025 · 2 comments
Closed

A great project! #19

hatemhosny opened this issue Feb 6, 2025 · 2 comments

Comments

@hatemhosny
Copy link

hey @x0k

This is such a great project. Thank you for providing that.

I would like to draw your attention to a project I'm working on, that I think you may be interested in.
LiveCodes is a feature-rich, open-source code playground that supports 90+ languages/frameworks (see starter templates). It runs totally on the client with no backend. It is free for unlimited usage with no account required. It has good mobile support. Projects can be shared, exported, deployed (to GitHub Pages) or embedded in web pages. There is a powerful SDK that allows embedding and communicating with playgrounds.
Please see the docs for details. Also check what makes LiveCodes different.

I see you have made a great job providing support for client-side interpretation for many languages. A few of these are already supported in LiveCodes. But I would be very interested adding support for C#, Java, Rust and Go (using wasm - we already support Go using gopherjs). Would you be interested in joining forces and help add these to LiveCodes? Of course, I would give you credits for these in language info modal and in docs.

You may also want to check language implementations in case you want to add some of these to your project.

What do you think?

@x0k
Copy link
Owner

x0k commented Feb 6, 2025

Hi. Thank you for your kind words!

I don't plan to spend time on other people's projects at the moment, but I can share my thoughts on supporting the above languages, which I hope will be useful.

In general, all *-runtime packages are self-contained, so you can adapt them quite simply by replacing primitives from the libs package with your own.

NOTE: ignore the *-test-program.ts files, they only make sense for my project.

C#

The solution is inspired by this project https://github.com/nbarkhina/CSharp-In-Browser

Docs https://github.com/dotnet/runtime/blob/main/src/mono/wasm/features.md

Unfortunately I haven't figured out how to redirect standard streams in c# yet, so the console patch is used to collect logs.

I haven't tried AOT compilation as it increases the size.

You can build a multithreaded version, but it won't run from the Web Worker and is a bit unstable.

Java

The solution is based on this old and unsupported project https://github.com/plasma-umass/doppio.

If you have a non-commercial project, it may be worth looking into CheerpJ.

This project requires node v12 and dependencies patches (see patches folder).

For some reason I was able to build the project with vite and used esbuild.

Since setImmediate is deprecated initially i replaced it with setTimeout but result was too slow, so mapping it to queueMicrotask is important.

But even so everything runs extremely slow at least because of the constant unzipping of dependencies, I tried to fix that but I failed.

Rust

I use a Miri solution from this thread rust-lang/miri#722 (comment)

If you plan to build it from source you may want to do this change also x0k/rust@e10b0ea

Go

The solution is inspired by https://github.com/x1unix/go-playground and based on https://github.com/traefik/yaegi

In Go 1.22 the fetch-based http client was broken in the browser, to bypass this limitation you can apply this hack

P.S.

My dev environment can be viewed in flake.nix and the build scripts in mkfile

@hatemhosny
Copy link
Author

hatemhosny commented Feb 6, 2025

Thank you, @x0k , for such useful guidance. I really appreciate that.
I believe this should be a good start.
Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants