Swift language minimalist logo9/2/2023 ![]() ![]() Switch statement based on any types, with the complex matching rules, so you can branch on ranges, or conditional expressions.Enum types can be based on any raw type (not only integers), and can have associated data depending on the enum value, so they also implement the functionality of union.Types can be extended outside of the original declaration and this can be used to make them adopt new protocols. ![]() Strong typing with type inference, with a differentiation between variable and constant, one declared with var, the other with let, no duck typing for functions, but the language supports templates and protocols (interfaces).This makes a big performance difference and is also a big theme in C++11 and C++14. This means that complex data can live on the stack and be contiguous in collections. Swift borrows from C♯ that classes are reference types and structs are value types, passed by copy to functions and methods. Compiled language, with the goal of being faster than Objective-C.Given the fact these day I mostly code in C++11 and Python 2.7, I found the language to have interesting features: Gone are the days were languages tried to be minimalistic, here the goal is clearly to implement features for common programming patterns. Compared to say Python, the language is actually pretty complex, as it has many features. Swift is presented as the successor of Objective-C, but drops the C compatibility while keeping a C-like syntax, in a way similar to Go or Rust, Swift borrows ideas from many existing languages: Objective-C, Python, but also Rust and C♯. Apple’s announcement of the Swift language was quite a surprise, while the company had extended Objective-C in the past, it had not dabble in programming languages since Dylan and Applescript, so I was quite curious to see what this is about. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |