krzyzanowskim / OnlineSwiftPlayground

Online Swift Playground

Home Page:http://online.SwiftPlayground.run

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Asserts don't work

marcogalluzzi opened this issue · comments

If you include "assert()" in the source code they don't seem to be evaluated. To reproduce the error just try assert(false). Nothing happens when executing.

This is because the source is compiled with optimization "-O", that disables assert
ref: https://blog.krzyzanowskim.com/2015/03/09/swift-asserts-the-missing-manual/

Of course, I didn't think about it. Thanks for clarifying.

However I would suggest to switch off optimization (-Onone) because the application is meant for people to "play" with Swift.
Another option would be to write a warning text about assert() not working.

Have a nice day