REPL ergonomics

Are you on Linux? There is a bug that you need to import Foundation first, compare Ubuntu developer snapshot requires Foundation for print statement and [SR-7801] Ubuntu developer snapshot requires Foundation for standard library symbols · Issue #4368 · swiftlang/llvm-project · GitHub.

$ usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM ec4d8ae334, Clang 5a454fa3d6, Swift 0ca361f487). Type :help for assistance.
  1> 2 + 2
error: Couldn't lookup symbols:
  swift_beginAccess
  swift_endAccess

  1> ^D

$ usr/bin/swift
Welcome to Swift version 4.2-dev (LLVM ec4d8ae334, Clang 5a454fa3d6, Swift 0ca361f487). Type :help for assistance.
  1> import Foundation
  2> 2 + 2
$R0: Int = 4
  3>
2 Likes