-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Base dependencies to be used in the playground #9
Comments
How would we decide what packages are included? Download counts? gleam_yielder, and gleam_deque don't seem like very good candidates to me, they are uncommon packages to use. |
Download count could be an indication but with time, big libraries will end up in the playground. And even if yielder or deque are uncommon, it can be useful to try them before considering using them in projects, or even just to understand how they work |
We definitely do not want to direct people towards those packages by default. |
Aside from the dilemma of choosing the packages, I tinkered with this idea for a while and made some progress. It involves changes across the stack though (including
|
This adds support to utilize the `/lib` path in a similar way to the `gleam-cli` compiler. It's currently the responsiblity of the caller to populate the files with `write_file_bytes` for this to be useful. ## TODO Because the `PackageConfig` is hard-coded and has no dependencies declared, importing anything from `/lib` will produce a "Transitive dependency imported" warning. ## Motivation While tinkering with the idea from gleam-lang/playground#9 Found that the current playground includes `gleam_stdlib` by pretending they're submodules in `src/gleam/io.gleam` for instance. This approach no longer works when you're trying to use more dependencies than 1. Mainly the `import .. from` JS statements will break as they're precompiled as *siblings* rather than clobbered into a single package with submodules.
When it comes to choosing packages, how about one of these three:
Because I think that Playground is an official resource, it should probably care more about what's right for the overall community, rather than convenience. We can debate what "right for the community" means, but remaining neutral on what packages you should use (whether endorsing or discouraging) seems like one position you could take on that. However by that logic Finally 3. would be a bit more challenging to implement, but would be a sensible official selection of packages. At this scale we'd probably need to switch from precompiling to downloading and compiling as-needed. |
Some prior art the Go playground lets you run imports (not sure if it's a subset). Rust playground picks the top 100 by downloads. Compiler Explorer does have a limited selection of Rust crates, not sure based on what. |
Hi
Since some of the stdlib is moved into separate packages, I thought it could be useful to add those dependencies in the playground, so that we can still use them.
i.e. adding gleam_yielder, gleam_deque and so on.
The text was updated successfully, but these errors were encountered: