[swift-dev] Importing .swift file into REPL?

Dmitri Gribenko gribozavr at gmail.com
Wed Apr 20 17:28:34 CDT 2016


On Wed, Apr 20, 2016 at 3:23 PM, Austin Zheng via swift-dev
<swift-dev at swift.org> wrote:
> Hello developers,
>
> Is there a way to import a .swift source file into the interactive REPL? There are times I'd like to debug code by importing it into the REPL and then typing in various interactive commands. However, copy-pasting does not always work properly, especially if the code is long and contains line breaks.

I usually iterate in a separate source file and use the 'swift'
interpreter when I hit issues like this.  Not a perfect workflow, but
does the job -- just a suggestion in case you're blocked.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-dev mailing list