Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Swift provides the ability to eval Swift code like Javascript does?

Tags:

ios

swift

Does Swift provides the ability to eval Swift code like Javascript does? I would like to create an app that can run Swift code.

like image 277
Boon Avatar asked Jun 08 '14 23:06

Boon


People also ask

Is swift similar to JavaScript?

There are numerous similarities between both JavaScript and Swift. There are some minor differences but their essence is the same. As compared to JavaScript, Swift provides a lot of advancements in syntax. Of course (arguably) it can be said that the more features a language provides, the more trouble it can create.

How do I run a swift code?

If you've installed the latest version of Xcode you should have a swift command available in your terminal, which launches a Swift REPL 1. You can run the Swift REPL from the command line and enter Swift code directly into it. Whenever you enter valid Swift code in the REPL, it will immediately compile and run it.


2 Answers

No, it doesn't. There is a Swift JIT exposed via the REPL, but it's not (currently at least) intended for use in applications.

like image 83
Catfish_Man Avatar answered Sep 27 '22 19:09

Catfish_Man


I think eval() is not implemented at moment. For REPL Shell look here Swift Blog

like image 20
Denis Kohl Avatar answered Sep 27 '22 21:09

Denis Kohl