I think the current examples/
directory in the repo is pretty confusing to beginners - it doesn't have a "hello world" (although the README references one that's no longer there) but it does have a bunch of fairly advanced use cases :sweat_smile:
I'm concerned that beginners will come across the repo, look in examples/
out of habit because that's such a common place to look for beginner-friendly examples, and have a bad experience...if we're just going to use that directory for testing, can we move it somewhere else and maybe just have the examples folder contain a README linking to where to find actual beginner-friendly examples?
I've really wanted to move it into the cli crate with all the other cli tests.
I've pretty much removed or moved most things already. It's just platform-switching that is used now for anything. The others like node and python interop aren't really tested anywhere afaik
I don't have strong feelings on where examples should live, but I do have strong feelings about a top-level directory named examples/
not giving beginners the wrong impression :big_smile:
My thoughts were to have my platform templates as examples instead of that... but I haven't got a node, jvm, ruby, or python ones yet
I kinda think at this point it would probably be more helpful to just have a readme of links to other repos
like "hey check out basic-cli/examples" and then similar for other platforms
I'd be happy to create repo's and move them alongside these https://github.com/lukewilliamboswell?tab=repositories&q=platform-template&type=&language=&sort=
I would like to point people towards https://www.roc-lang.org/examples
We can provide markdown content, and potentially more interactive experiences in future with upgrades.
Luke Boswell said:
I'd be happy to create repo's and move them alongside these https://github.com/lukewilliamboswell?tab=repositories&q=platform-template&type=&language=&sort=
It's difficult for me to maintain all these, but I usually just update them when people need / ask in zulip
having the examples/
dir just be a README which links to roc-lang.org/examples
sounds good to me! :thumbs_up:
You don't have thoughts about keeping the ruby, node, jvm, python interops?
Or where the WIP virtual dom thing could go?
@Anton has said he would like to keep platform-switching to help with debugging.. but that can move into the cli crate
I think it's nice to have those somewhere
but I think it's bad if examples/
has those and not something more basic like hello world
if we want to put more basic examples like hello world back in examples/
, then I think it's fine to have stuff like python and JVM interop in there alongside the more basic ones
but if we're not going to put the basic ones in there, then I think we should put the interop examples somewhere else (not sure where though!)
If anything examples should be exclusively basic CLI and basic webserver
Beginners should not really eat thinking about platforms
I think having platform switching examples is a mistake for a beginner to the language
That isn't useful until someone is sold on the language and wants to make a platform
Two PR's
examples/
folder in roc-lang/roc
roc-lang/examples
One useful thing the examples are doing right now is serving as a large(er) code base that we verify parsing and formatting on. Would be nice to make sure we don’t lose that coverage somehow.
We still have CLI tests in the repo. They are used to keep some examples around
Also, we should definitely set up a job to run all the code in the examples repo to make sure they don't break.
Though I guess part of the reason for pulling things out of the roc repro was to decouple updates
Brendan Hansknecht said:
Also, we should definitely set up a job to run all the code in the examples repo to make sure they don't break.
They get tested with the nightlies, and when making a new release of basic-cli.
Joshua Warner said:
One useful thing the examples are doing right now is serving as a large(er) code base that we verify parsing and formatting on. Would be nice to make sure we don’t lose that coverage somehow.
The examples that are moved out above are the pthon/java/ruby interops which aren't used for anything like testing parsing etc, so we're not losing any coverage.
Platform switching was just moved into the cli crate with all the other tests.
Pretty sure that's explicitly using that code in tests
It has definitely caught some interesting bugs
Probably should change it to the CLI test folder
Do you know where that'll be, relative to the repo root (in CI)?
I think crates/cli/tests/
test-projects
would be examples but for general parsing, I would include the entire folder cause might as well test parsing and formatting the benchmarks too
One useful thing the examples are doing right now is serving as a large(er) code base that we verify parsing and formatting on. Would be nice to make sure we don’t lose that coverage somehow.
I've been thinking that we should add CI tests that use the exercism and examples repo. We can make it so that they're not required to pass, only to inform us.
That would be pretty helpful, if you get the opportunity
Nvm, you didn't say "I" but instead said "we". This could be a "good first issue"
Last updated: Jul 06 2025 at 12:14 UTC