Both iOS 8 and OS X Yosemite were clearly the focus of Apple’s WWDC keynote, but one of the biggest surprise announcements was the reveal of Swift, a new programming language for developers. One of the language’s most noteworthy features, the playground, allows developers to test their code as they type, but without a “sandbox” to protect the computer, this can lead to some very unfortunate accidents.
As developer Steve Stroughton-Smith (@stroughtonsmith) warned his followers on Twitter:
Protip: while in a Swift playground, for the love of God don’t write system(“cd ~; rm -rf *”). Runs-as-you-type has its downsides!
— Steve T-S (@stroughtonsmith) June 4, 2014
You don’t even have to hit enter for the command to take effect. If you were to type that in a Swift playground, the deletion would be automatic. This is obviously a huge liability for any developers giving the brand new programming language a whirl this week, so it’s worth being extra careful if you’re one of them.
Also worth keeping in mind: don’t click any suspicious playground links you find on the web. As noted, if a dangerous line of code enters the playground, you won’t have to time to stop it. We’ll keep an eye out to see what Apple has to say about the vulnerability.