Interesting to see Apple announce a new language, Swift, at their WWDC. Swift bears a certain resemblance to Lua (functions are first class objects) making me wonder if it would have been better to just use Lua (or maybe Python). However, I think that Swift is a strongly typed language not duck typed. But variable types are usually inferred so in practice you see few explicit type declarations. Generics are supported as well making it look a bit Java-like...
Whether the world needs yet another programming language I'm not sure...
One thing I do approve of is a nice, readable for loop "for i in 0..3" rather than the ugly C "its really a while loop" one (although that is still an option). They've also got rid of semi colons but kept the braces (ugly!). There is no elseif either so you still need stuff like "} else if (condition) {" unfortunately.
Here's a quick overview:
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2
Comments
It has reminded me a little Python and Lua too.
but Swift is faster for encryption (Apple not compare it with Lua)
Maybe Apple wants to simplify some things.
Safari of its new OS X Yosemite It is made with Javascript
http://www.apple.com/osx/preview/apps/
And Apple shown as its safari have better performance than google chrome
On the other hand is the issue of integrating Macs with iOS, as they have grown 12% last year while PCs have fallen by 5% in the same period.
[-] Liasoft
Looks like Apple never heard of Lua unfortunately... Would be interesting to see where Lua would sit on the speed chart above especially with LuaJIT.
I think Swift is basically Lua/Python with strong typing. You cannot do (as in Lua),
x=5
x="hello" -- change type of variable
and I think you cannot have heterogenous lists
A = { "foo",1,{1,2,3},{} }
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
Anyway they could use Python or Lua, why do they create a new language?
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
I will review the Swift free book, published by Apple
https://itunes.apple.com/us/book/the-swift-programming-language/id881256329?mt=11 I guess this is done in order to improve the performance of the code as C++ (string, bool, ...)
I also think (maybe I can be wrong) as Swift looks like Python canno't make you do the next
[-] Liasoft
Swift,
I love it: No more headers, no more types (mostly), no more semicolons, is module based, retains native performance
I hate it: Only Apple (obviously, but still!)
https://developer.apple.com/library/prerelease/ios/referencelibrary/GettingStarted/LandingPage/index.html
It seems easier and powerful than Objective-C.
For example to use all Foundation API:
My real question is if we can build mixed apps using Gideros and Swift where some scenes are developed on Lua + Gideros and some scenes using Swift. Or may be a Lua + Gideros compiler to Swift code.
To me it has taken it's life from modern languages like Ruby, Lua and Python while eliminating issues from each of them. The python's indentations, Lua's perhaps too relaxed aproach and Ruby - I have absolutely no idea (do not work with it) but remember seeing some articles where it was used like the extension example with Swift.
3.repetation({println("Hello"})
I was actively busy on another project involving a lot of dotNet (not my favourite language but more preferable than Java) and I was trying to integrate Lua into my code somewhat similar to what Wax does. Due to the wonderful reflections functionality iin DotNet, the entire classes and methods are available with Lua in a single Import function from Lua script similar to the example above by jdbc.
If you want, you can head to this article http://howto.oz-apps.com/2014/06/swift-and-shift-new-language-from-apple.html on further thoughts on Swift.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Nice Paper!
Also I read: "...Apple wants to use its heft to weaken the Android app ecosystem. Thanks to their shared support for C, and tools to port Objective-C to Java, it’s currently fairly easy to port an app from iOS to Android. Porting Swift apps to Android, on the other hand, would be a lot more time consuming."
But I think the above is a matter of time.
What I want to know (as @john26 said) how quickly is LuaJIT against Swift or how it could be measured? :-? though first we would have to install Xcode 6 Beta.
[-] Liasoft
thanks for your replay
Swift looks like dynamic languages, but is not one... "There is type inference, which means you don’t have to actually write down the types everywhere, in particular within functions. But types are there nonetheless"
Here I leave this article I also found interesting
http://blog.bruchez.name/2014/06/thoughts-on-swift-language.html#fn:3
[-] Liasoft
http://marchdvd.com/?p=225&cpage=1
and LuaJIT is like C++ in time compilation, in this case.
Likes: SinisterSoft
[-] Liasoft
For those who see a future in HealthKit, HomeKit, iOS in the car and everything else, learning Swift (or finding a Swift coding ninja/rockstar with 10 years of experience) is the way to go I guess.
Unless they can be targeted from cross platform frameworks but I am not sure about it.
@OZApps read your article then went to check on twitter.
I really hope that the two twitter accounts that you mentioned don't become the go-to resource for news about the language. I hate the fact that "something is going on behind the scenes".
Not to mention the humour.
Are you aware of more reliable (independent) sources of information?
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Does anybody try it and having same problem?
Maybe it's too early to find reliable channels to follow news on the topic.
Assuming you're a registered developer, login to this page:
https://developer.apple.com/devcenter/ios
Select the iOS 8 beta tab in the main pane and xcode 6 beta download will be there.
I have a look to swift then.
It is unclear on what is covered by the NDA as the book on swift is free but pictures of OS X, xCode are all under the NDA. If you want to learn about any of these, the Apple videos are amazing and better in comparison to the earlier ones from previous years.
Wait till september, there will be a lot of Books, courses, etc that would be available.
GitHub already has several samples, stackoverflow is *overflowing* with swift discussions, reddit and IRC also is buzzing with advanced discussions.
The point is finally this is a script like language and has a terminal (command-line REPL) or the GUI based Playground (Live-Coding) with amazing capabilities. It all depends on how easy it would be to integrate with what we want AND secondly, it is available for newer versions only, so it will be a while before everyone would be able to use them in apps and have apps made with swift.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
I'm wondering what the official learning center by Apple will look like.
Dev oriented, and/or "want to be a dev in the future" oriented.
Certainly, there is an idea behind the choice they made for demonstrating Playground.
They might want to open it to the education field next, now that the barrier to entry is a bit lower.