5
\$\begingroup\$

Are questions about code and its performance in a "Playground" on-topic?

This question is primarily inspired by this question (which is off-topic anyways as being broken code): Simplify expression in Swift playground

In Xcode, one of the project types you can create is a "Swift Playground". Presumably other languages and IDEs have similar "playgrounds". Essentially, rather than waiting for you to push a "build" or "run" button, the "playground" compiles and runs as you type.

I don't know about other environments/languages, but with Xcode and Swift, you can not then turn a playground project into a compiled program that you can run outside of Xcode (other than copypasta). The playground can be great for quickly testing things out, but things do behave slightly differently in the playground than in an actually compiled executable program. Even if you're still running in the debugger through Xcode, performance is different between the playground project and a regular project.

When answering this question, please consider the following points from the help center:


Is it actual code from a project rather than pseudo-code or example code?

While sandbox code isn't pseudo-code, is it actually from a project? If you can't compile it into an executable program to be run anywhere outside of the playground, can it be anything other than example code?


To the best of my knowledge, does the code work as intended?

Given that behavior can differ between a playground and non-playground, does code tested only in a playground count as working to the best of your knowledge?


Do I want feedback about any or all facets of the code?

Would a user who is only interested in how their code runs in the playground be interested in feedback about how their code performs when actually compiled into an executable program and run?

\$\endgroup\$

2 Answers 2

10
\$\begingroup\$

I would advise against taking a narrow view of what constitutes a project. Some languages are supposed to be used in a read-eval-print loop (e.g. and ). There is no reason to require code to be compilable or linkable to be reviewable.

\$\endgroup\$
2
  • \$\begingroup\$ Playground is a bit different from REPL... \$\endgroup\$
    – nhgrif
    Commented Feb 19, 2015 at 22:03
  • 4
    \$\begingroup\$ Even if they are different, I don't see enough justification to discriminate, or to make our rules so rigid that sandbox environments are ruled off-topic. \$\endgroup\$ Commented Feb 19, 2015 at 22:07
9
\$\begingroup\$

Is it actual code from a project rather than pseudo-code or example code?

While sandbox code isn't pseudo-code, is it actually from a project? If you can't compile it into an executable program to be run anywhere outside of the sandbox, can it be anything other than example code?

Yes, it is from a project. A Sandbox project that may be, but Sandbox projects are also projects, just like FizzBuzz projects are projects.


To the best of my knowledge, does the code work as intended?

Given that behavior can differ between a sandbox and non-sandbox, does code tested only in a sandbox count as working to the best of your knowledge?

Can differ. Does not have to differ. As far as you know, it works. It is practically impossible to enforce a requirement for how much code has to be tested in order to be on-topic (and please don't try to push it). If it works in the sandbox, it is working to the best of your knowledge.

Do I want feedback about any or all facets of the code?

Would a user who is only interested in how their code runs in the sandbox be interested in feedback about how their code performs when actually compiled into an executable program and run?

Why would you not be interested in how it performs when actually compiled into an executable and run? If someone wants to code in a sandbox first and then later transform their code into a non-sandbox project, I see no reason for why they would not be concerned about this.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .