How does "go" Evaluate Apple's new programming language, Swift?

Source: Internet
Author: User

How do I rate Apple's new programming language, Swift?

Original address:http://www.zhihu.com/question/24002984

Evaluation: If you will objective-c, you do not need to see it.

        If you ask me this language is not important to the average developer, I say it is important to tell you this clearly-it is Apple's blockbuster language to the world in WWDC how can I say it doesn't matter? It lowers the threshold for entry. So a lot of JS, Python, Ruby users will use Apple's technology to develop programs for them. Its role, like Core Data, Interface Builder, enables you to quickly write a program that works. But if you want to do some serious work, there is not enough strength in your mind. So and Apple's own mail will not go with core Data, iphoto will not use Uicollectionview, the slightly more complex apps will not go with interface Builder, Apple itself will not use Swift. It just gives a small team of 35 people the ability to quickly make use of the program, so that big companies can quickly do some prototype. Some say it's the equivalent of C #, or the equivalent of Scala's improvements to Java, and I can tell you that Swift is not the language. It's more like a toy language that makes a quick prototype.

The call for Apple to release the next generation of Objective-c languages is long overdue, with tens of thousands of-word OS X reviews Ars Technica wrote two years ago that Apple should do a language, objective-c without C and use more modern features and more Short API, and support for automatic type deduction, see OS X 10.8 Mountain lion:the Ars Technica Review.

But Apple apparently didn't take the language seriously. It's obvious that they don't want to replace the OBJC at all. And in Apple's style, if they treat Swift as OBJC's future, there will surely be one or two IOS/MAC applications that use swift rewriting. (for example, when Apple hacked Carbon, the first thing to do was rewrite the Finder).

-its standard library is too poor, only Dictionary, Array and String and number of data structures, not even a Set. Want to use something else? You still have to use the OBJC.
-it has no support for asynchronous/synchronous programming. It cannot be bundled with GCD, so any serious Web application cannot be written at all.
-it does not have any protection mechanism (private, protected), all the method and variable are globally visible, which obviously can not meet the needs of serious projects.
-can only interact with OBJC. If you want to use C or C + + seriously, you have to write OBJC wrapper.
-no way to catch objective-c exception, if once out of exception, your App immediately collapsed.

Chris was able to clearly see his short-sighted in designing the language. This is normal, he is a compiler, not to do language research. So the language that this door claims to support functional programming is not functional at all:
-Only supported in lazy, closed, and simple function language functions (such as map, filter). You can do it in OBJC.
-No pattern matching
-Type deduction is almost the same as c++11, without the use of Hindley Milner.

From these features, Apple's positioning is only for the OBJC headache developers to reduce the learning curve of the toy language introduced. Each of the previous five items is basically fatal, so Apple's own projects are not used. It is possible to do an early proof of concept prototype.

I can imagine that the implementation of Swift is very simple (LLVM is very mature, writing a new language is more and more simple, such as a few steps to be able to make a small language: 1. Kaleidoscope:tutorial Introduction and the Lexer, of course, it's possible that Apple will solve these problems in the future to make it really practical. But for now, Apple doesn't want Swift to replace Objective C.

Here's a list of some of the other great gods that you know about, and the number of votes that others give to this review:

"User's answer (104 votes)":

Mahle Gobi ... ..... ... ... ..... ..... ..... ..... ..... ..... .....? ......., ... and ..... ..... the .......

No one is worse than me,!!!!!.

I just finished answering this question, I saw this ghost thing ....

What were you doing at the age of 26? What do you want to do?

My graduation design is a simplified version of the apple thing.

The most painful thing for me is what I've been doing for the last half of the year, the castrated version of this thing on iOS, and it's pretty smug ....

Development of the Big six months, all his mother ...

Let's be a practiced hand.

Back to the question, Swift is an attempt at future programming trends, and it can be seen that Apple is careful but ambitious.

Apple is very dark, copy other people never give money not to say, also do not mention the contribution of others

AutoLayout So, this must be so.

This concept of milk is Apple's former employee, ipad interaction designer, Coreanimation programming guru Bret Victor, proposed 2 years ago

The context is not accessible, can be onlookers this speech

Bret victor-inventing on Principle http://v.youku.com/v_show/id_XMzUyOTIyNzg0.html

"Belleve's answer (32 votes)":

Native version of the scala-c# complex to manage the memory itself.

(You see how long I have used words to describe clearly ...) )

Do not know how to do the parameter polymorphism, do not learn Java play type erase ...

And Where's call/cc? <del> Incompatible Classic Logic </del> language with no call/cc or equivalents will fall into the triangle code.

I have said in the programmer that the popular language should be learned from childhood, and this is no exception. PL development So many years, the digging semantic characteristics are almost, the left is the compiler back end of that dissected thing, this block find @ Blue, @ Chen Fu 鸼.

But for the objc of the plight of the family:

Playground is a bit of technical content, but it is also an abstract interpretation can be achieved.

"User's answer (39 votes)":

After reading the official guide (the Swift programming Language:about Swift), back to feedback, is

This is a castration away a lot of the essence, added some syntax sugar of C # and Scala, a combination of some Golang convenience features, with Golang and JS many deceptive traps, syntax and JavaFX close to the non-UI part is not serious enough, There is no GC other than arc, a language with strong expressive power but weak design ... In other words, it's a pit for large projects ... More suitable for PM and small workshops to quickly launch creative prototypes, not for the pursuit of high-quality application development.

And

All-public variables as a serious language to write business logic really real men?

There are too many kinds of libraries have been made of keywords, see a person like it, after all, it seems more convenient

See said closure is reference type of time also think that Apple is more than Java enlightened, the result is a dabbler project, is a reference yes, but as a reference where the dignity? The ability to express is a whole lot weaker ...

It's a good thing to have a delegate, but you delegate. Really not interface-oriented programming ... It is interesting to deceive the people's feelings ...

Arc inside said incredibly need weak reference and arc and weak reference incompatible, almost frightened cry ... For guide said to use weak reference scene, this is almost run must segment fault AH ...

Hey, async async asynchronous asynchronous ....

In addition, who can tell me how to deal with this goods abnormal ... A language that cannot be handled in an unusual way is not written like crap.

"Vczh's answer (13 votes)":

@yue Wang's answer is well written and should be looked at.

I just want to say that many of the decisions made by Swift are just like I www.gaclib.net the script that was invented to write into XML, for example, $x is used to represent lambda expressions, types are written behind names, and only let and lambda can do type deduction, The library that was written in an incomplete GC language is directly map to the object model of the script (basically the script looks so awkward because of this, and so is my one) ...

Apple pills

But anyway Swift does so ugly fruit powder will not have the opinion, because at least better than the ugly oc good-looking (escape

"Yu Yuxi's Answer (19 votes)":

Visual inspection of Apple this will be successful in attracting a large number of obj-c annoying so do not touch iOS Dynamic language Developers test the development of iOS, especially the web developer this piece. The competition between platforms, developers have to get the world. On the battlefield for developers, whether it's Native vs. Web or IOS vs. Android, this is a good game for Apple.

"Chen Meyang's Answer (8 votes)":

All the people are 0 basis? This is a bad remark. Programming language to the present, a large part of the work is the library as a support, you do is the work of building blocks, coupled with logic judgment, loop, recursive, iterative and other part of the logic. Plus concurrency, multithreading, and so on, but the latter is already full of "library" words. Even the FP is almost the alternative expression version of the callback function.

The objective-c will certainly be able to better master Swift.

However, the compiler, know the LLVM architecture or discrete math, JS programming, library programming mastered especially good people, will certainly be able to pick up faster swift. The new features of all these languages, which had been raised many years ago, just need to be packaged, integrated and advertised.

The new language is basically just different from the people who want to get started.

After a deep understanding, the difference is not so great, because no matter how the language changes, you want to achieve the operational effect, imagination, maintainability is the core. As long as you are programming Daniel, then you are programming Daniel, is not related to language.

"Wang Yizho's Answer (11 votes)":

It ' s an very expressive language.

To some people who feel that "the level of programming finally and everyone in the same starting line" to teach some cold water. Swift's language of coder creativity will only make the gap between beginners and masters even greater. A language is about expressing yourself. Swift removes a lot of boilerplate, giving people more emphasis on expressing themselves rather than fight the language (<-Java). The key point is how to make closure, type inference and generics work together. Given that Apple has always cared about backward compatibility (<-Java), it should be able to reach the C # level.

In addition, this is not the (dead) JavaFX script: JavaFX script

Some of the code example for JavaFX Script:

Import Javafx.stage.Stage;

Import Javafx.scene.Scene;

Import Javafx.scene.text.Text;

Import Javafx.scene.text.Font;

Stage

{title: "Hello World" width: height: scene:scene {content:text

{font:font {size: $} x: ten, y: content: "Hello World"

}

}

}

Import javafx.ext.swing.*;

var myframe:swingframe = new Swingframe ();

var Mylabel:label = new Label ();

MyLabel.Text = "Hello world!";

Myframe.width = $;

Myframe.height = ;

Myframe.visible = true;

Myframe.content = MyLabel;

In NetBeans, it is similar to Playground's WYSIWYG.

It was also written in JavaFX script to rewrite some Java animation, which is actually more concise than Java (there is no language verbose than Java). But it is also limited to the UI-related code, more logical words or written in Java.

"Yuanyan's answer (3 votes)":

Like the "Write the code" mentioned in this slogan. Change of the world, this is the biggest highlight of the non-swift mo. Apple should have started two or three years ago not satisfied with the obj-c language skills of development efficiency and engineering capabilities, the release of the new language is also Apple's feedback to the developer (with Apple's strong product position), read the next "the Swift Programming Language" ebook Itunes-books, some impressions:

0. No number ";", likes

1. Compared to its obj-c, the overall grammatical style looks comfortable, and experienced developers spend a few minutes quickly flipping through it and should be able to quickly develop

2. A number of new keywords were created in Swift? Subscript, protocol, extension ...

3. Like optional Chaining, very useful grammatical sugar: foo.bar? Baz if bar is not nil, call the Bar.baz method

4. I still haven't found the package or namespace introduction, what's the situation?

5. In the past Obj-c only run on the client, is swift a chance to let it run on the server side?

6. What's the next Swift call? What is the open source of Swift?

"Saviio's answer (3 votes)":

After this macruby is small three .... It's never going to help.

There are closures on the graph, namespaces, multiple returns, type derivation, pattern matching, operator overloading

Look forward to Swift for a moment, specifically read ref. Functional pattern+object orientation a scala lol ....

Also, Apple's LLVM is not unreasonable.

is to take the static and dynamic ratio, but also with Python than ... Apple is not a kind-natured.

"Title of the answer (0 votes)":

As a JS developer feel it, I Macbook Air users, a year Backbone application development experience.

Introduction Go, Haskell and other languages, Coffeescript best friend, to do the MVC interface is much more than the underlying implementation.

Try to see a little bit of objective-c, but the threshold is immediately scared off, as well as the huge IDE.

My long-term writing coffeescript, not do not understand programming, but difficult to convert the idea of programming,

In syntax, Swift is a feature that has long appeared in other programming languages. There is no such revolutionary intent as Go.

But the language of the friendliness of the debugging environment has been released let me feel a lot of lower threshold.

In addition, the syntax has good statements often encounter problems is performance, Apple gives the data is also very good.

So watch it.

"User's answer (5 votes)":

In terms of language, Swift has nothing to say, no silver bullet for the new language forever.

Playground in actual development I don't think it's as big as expected because most of the application logic is complex and context-sensitive.

But it's very helpful for prototyping.

"Thoughtful answer (5 votes)":

I looked at the one or two chapters and modified them in the first image.

Much more convenient than OC

But it's basically a language that's been copied a little.

By the way, this WWDC.

WWDC = = We'll definitely Copy

"User's answer (5 votes)":

Just watched the live, the first time to see this new language is really bright! (After all, the highlights of this year's conference are few ... )

As a little white that is getting started, it must be a sense of accomplishment to develop a feeling of instant preview and it is more intuitive to know which one is more likely to be in bad. I can see that Apple wants to promote the development of the app to non-professional enthusiasts, I think this idea is very exciting, many people take apples as forcing lattice of things, but Apple is how to make it more pro-people more audience, not only to enjoy the convenience, but also to develop their own. After all, no one knows their own needs better than themselves, which is a particularly interesting idea.

Swift has not been received, believe that a period of time to apply in practice, will give more objective evaluation. Hope it can surprise us, and the great God with a new language, think of a little excited about it.

"Xuan Boo's answer (3 votes)":

See Playground when you see VAR and let, there are closures, there are generics, there is type inference, Fast iteration should be similar to LINQ, Real-time compilation of the language may be able to support the run-time compilation run, so I think the syntax and runtime can be more than C #.

Dig in, and when I have finished reading back to add the answer.

"Li Zhugang's Answer (5 votes)":

who just bought "iOS Development starter" ...

"User's answer (1 votes)":

The optional type reminds you of the dart;local inference, the multiple return value, the Func keyword (and the declarative syntax of the function return value), the conditional statement without parentheses, no semicolons, a switch without a break, and so on. Some functional grammatical features, algebraic types, pattern matching, and so on are added.

There are many many and c#,scala very similar, everyone very familiar with the things, do not list.

There's no concurrency, there's a bright spot in parallel programming, or the actor-model process isolate like Erlang (Dart absorbs this), or the Chanel is straightforward like go. There are also problems in other languages that have not been improved but have been preserved, perhaps in the sense that it is too radical.

And OC can be interacted with (but not by C + +), and the underlying base is LLVM compiled to native code. Similarly, like Go's original intention, is to make a tool out, improve the production efficiency of yards, rather than engage in language research and innovation. Tall apes, especially FP enthusiasts, can still despise the language.

In other words, the author invented a language that looked at another language that he often used:

Go's author--Look at C uncomfortable;

Dart's author--looking at JavaScript is uncomfortable;

Hack's author--To see PHP uncomfortable;

Swift's author--See objective-c unhappy.

Where should the next language appear? Amazon OR Miki ...

"Yan Chanlang Iceskysl's Answer (2 votes)":

Geek College Latest courses released WWDC2014 detailed Osx/ios8/swift language, in general, the emergence of Swift to let a lot of people excited, after a careful look at the feeling of the pit (after all, the lack of things still a lot) ~

But as with Golang's release a few years ago, Swift's starting point is good, it just takes some time to improve

Appendix: Swift Language courses released by Geek College

http://www.jikexueyuan.com/course/89.html

Original address: Know

Permanent link to this article: http://www.cnblogs.com/ChenYilong/p/3765586.html

Apple's official document on Swift: https://itunes.apple.com/cn/book/swift-programming-language/id881256329?mt=11


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.