I hope the Golang of the feature

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

If you have the following features, go can make the programmer more efficient.

1. Automatic conversion of mathematical types. Now do an integer with the floating-point calculation also to manually turn the type. It is said to be for more secure and predictable code. But other mainstream languages support automatic turn, and everyone is used to it. Where type safety needs to be considered, the person who considers it will naturally consider it.

2. Support from polymorphism. Interface support for polymorphism is still relatively limited. Down casting can not do sometimes is not very convenient. The following code, for example, cannot be compiled.

Type Base struct {    xxxx}type Derived struct {    base}func main () {    v1: = &drived{}    var v2 *base    v2 = V1//Compile but    v2 = *base (v1)//Not also}

3. More convenient operation of the array such as contains (this very common thing is not really inconvenient), use the plus sign to connect the array (every time to write append is too modern), map (map and generator such things sometimes used to be too convenient), Sort (the sort library is still not easy to use) compared to Swift, the operator function is cool.

4. More container libraries, such as set,sortedset, etc.

5. Dynamic Link library. Just know this time is still a little surprised, to replace the C + + language, this thing does not support how possible? Wouldn't it be a lot of trouble to expand?

6. Support for better exception handling. Panic is still too troublesome, always want to knock repetitive code, fingers too tired.

7. Parameter table with name and default value of parameter. Why doesn't this good thing support Nikki?

8. Macros. Macros like __file__ and __function__ are useful. Some places use macro definitions to save a lot of code.

9. Method overloading. With 7 can be implemented together.

10. Class method. Prefixing the method name can also be simulated, but it's hard to see, isn't it?

11. Ternary operator. X?x:x. Don't understand why not support this ancient function, forget?


Cond...

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.