2

Stack snippets are a great feature. They greatly increase the reproducibility of answers in JavaScript, HTML, and CSS, as well as supported frameworks like React.

Already, many answers link to external services for this functionality. Many Rust questions link to the Rust playground and Python questions to repl.it. This greatly increases the quality of these questions, but often people post only a link and don't include the actual code which harms the quality.

My request is to build a feature like this into Stack Overflow, to promote short reproducible examples in all languages. Either by building something yourself or by partnering with one of the many services that offer code execution.

Some services that include a convenient API for integration include:

There is an extensive list here. Not all of these offer APIs though.

Of course, using any of these services should include a financial contribution to their hosters, so they can deal with the increase in scale required.

I'm aware of this question which suggests iframing a specific service while I think a better approach is keeping the UI entirely inside SO and then communicating via a API.

6
  • 1
    A working prototype is already in use for Python. Oct 25, 2022 at 6:52
  • 1
    Yea I saw some options for various languages emulated in JS but they are not exactly easy to find for new posters
    – mousetail
    Oct 25, 2022 at 6:56
  • 5
    For requesting features like this, a concrete proposal for a specific language is probably a better request than adding some new language. That way, staff can evaluate the desirability of each language to help prioritize which might be the most useful, easy to implement, etc.
    – Ryan M Mod
    Oct 25, 2022 at 7:19
  • "This greatly increases the quality of these questions" Please expand on this if you are going to turn this into a specific feature request. As someone sitting behind a subpar network for an entire week, having to invoke an additional layer does not seem like a win versus just pasted results into the answer statically as text. Oct 25, 2022 at 8:56
  • 1
    @MisterMiyagi This is why I don't like the iframe option. If you use a API instead the code will appear like normal just with a "run" button added. If your internet is bad you can just choose not to press the run button and get the exact same functionality as before.
    – mousetail
    Oct 25, 2022 at 9:00
  • 1
    @mousetail "If your internet is bad you can just choose not to press the run button and get the exact same functionality as before." Erm, no. I would not be able see the output because people don't add it to the answer anymore. Oct 25, 2022 at 20:35

0

Browse other questions tagged .