3 ms·
Something I really like about the Typescript playground is it has lots of examples with documentation and, not to put too fine a point on it, they all compile a
by mcintyre1994 6y ago
Something I really like about the Typescript playground is it has lots of examples with documentation and, not to put too fine a point on it, they all compile and run. Obviously this isn't designed for the same use case, but it'd be nice (from my perspective!) to be able to load in some example code that already works and doesn't produce an inscrutable (to a beginner) compile error.
I'm sure this would be a great resource if I did start trying to learn the language though, so thanks for sharing it :)
- steveklabnik 6y agoYeah, the relationship is a bit different. In Rust, we tend to have docs that embed the playground or link to it, rather than having the playground link to docs.
- mkesper 6y agoExamples from the book shouldn't be too hard or at least some link to it?
- steveklabnik 6y agoSure. Here's a random page on the book: https://doc.rust-lang.org/stable/book/ch08-01-vectors.html https://doc.rust-lang.org/stable/book/ch08-01-vectors.html You can click the arrows to run the code. This effectively makes an AJAX call to the playpen, and puts the results back on the page. Here's a random page from the API docs: https://doc.rust-lang.org/stable/std/string/struct.String.html#examples https://doc.rust-lang.org/stable/std/string/struct.String.ht... Those "run" buttons will open up the example in the playpen so you can play around with it. I think ideally these would all let you edit in place, run in the page, or open in the playpen, but they use slightly different tooling and nobody has put in the work to make it all identical yet.