The best forum is swift@tensorflow.org
. Join in at: Redirecting to Google Groups
The %install
directive is used to install Swift Package Manager packages!
Think of this like !pip install
commands that run inline in your notebook.
I understand that part, it just seems an arbitrary and irrelevant name. Are there any explanations of why in
is used? in
makes me think that the first part is somehow part of the second part or maybe it comes from the second part, and it makes my brain stuck when I see it.
Low level objects like float and array are defined in a Swift library file.
-
Are these then pre-compiled to machine code?
-
Do we have confidence that this generated code is as good as what a human programmer would write?
-
When basic types are extended, how or when is the extension compiled? Or is it interpreted?
Obviously I am concerned with execution speed and interpreter responsiveness.
You raise some good points. Check out the Swift forum post linked by @marcrasi for some historical context.
Here’s a thread on the Swift forum about the in
keyword in the closure syntax. You’ll find historical reasons explained by some early engineers on the Swift project including Joe Groff and Chris himself. Hope this provides some more context!
Ah, I just noticed that @marcrasi already posted it above!
Over 9000 times faster…
- They are compiled when the standard library is compiled (typically distributed with the compiler).
- Check out the GodBolt compiler explorer where you can see the generated assembly. In general, it’s pretty good. (e.g. check out: Compiler Explorer or the spelled-as-an-extension-alternative: Compiler Explorer)
- They are compiled when the extension is compiled, or in the case of Jupyter when you run the cell that defines the extension. (They are not interpreted.)
Is there any web frameworks similar to Flask or Django for Swift yet?
There are things like Vapor and Kitura. Not sure how close they are to Flask and Django though.
Do you know how it compares to Flask / Django?
Vapor looks pretty Flasky to me at the highest level
Vapor. Kitura. Perfect.
IBM is a backer of Kitura.
How do we know that calling f()
is not optimized away in this case because of e.g. lack of side effects detected by the compiler?
Here was my attempt at a webserver for Swift, it’s very much half-baked, but Swift is great for server stuff!
Wow: %install libraries straight from github… just realized now
Swift.org has a Swift Server Work Group led by Vapor, Kitura and SwiftNIO project members. The group is backing a few projects such as SwiftNIO and swift-log.
Yes! Here’s an excellent comparison of two Swift web frameworks, Vapor vs Kitura.
Check it out to see snippets of the frameworks (route registration, asynchronous code, etc).
In short:
- Kitura APIs are more similar to existing industry-adopted frameworks (like Node.js/Express.js).
- Vapor APIs are designed from the ground-up using Swift.
Just to confirm, are you referring to the time function?