swirldev/swirl — pull request #178 by ncarchedi (2014-07-16 20:27:13+00:00)
Title: New question type accepts multiline input from user

## Summary

I've prototyped a new type of question type called `script`, found in this pull request. I've also created a demo lesson in swirl_misc that shows off the basic functionality of this new question type. Here's how you can run it for yourself:

```
devtools::install_github('swirldev/swirl@script') # install this branch
install_from_swirl('Script Demo', dev = TRUE) # install the demo course from swirl_misc
swirl()
```

## Explanation

We've discussed many times the prospect of allowing multiline input from the user. Essentially three options are available:

1. Have the user type multiple lines of code at the prompt
2. Use `fix()` or `edit()` to have an editor pop up, within which they can edit code
3. Open an R script and source the contents

After much thought and experimentation, number 3 seems most promising for the following reasons:

1. Scripts are where real programming takes place (authenticity is what we hang our hat on)
2. You see everything, in contrast to `fix()` or `edit()`, which only presents e.g. the body of a function being edited
3. Typing multiple lines of input at the prompt is unwieldy and unrealistic

## Thoughts and feedback welcome!