• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Swift


  • Subject: Swift
  • From: Mark Bernstein <email@hidden>
  • Date: Thu, 05 Jun 2014 14:18:25 -0400

All the discussion of modulo arithmetic and the range operator syntax, it seems to me, is missing the boat. Surely these are minor features of the language.

Some things I've noticed that will matter a great deal include:

• Namespaces.  No longer need every class be prefixed by an alphabet soup of initials.
• Const correctness. 
• Chained initializers.
• Hooks for willSet and didSet.
• Null objects. The most sophisticated support I've seen for graceful response to failure.

Questions that I've not yet figured out in my first pass through the book -- and which I think will also matter a lot -- include:

• support for polymorphism.  In C++, we dispatch on the type of the operand:

bool DoSomething(int);
bool DoSomething(const string&);
bool DoSomething(Widget*);

ObjC doesn't do this, which complicated writing Visitor patterns among other things.  Where does Swift land?

• the beefy switch statement is interesting, but I think lots of sentiment views switch() as a code smell. What’s its motivation?

• the language is billed as offering better runtime performance, presumably because it's easier to optimize than ObjC. However, it does accept a number of performance hits, such as range-testing array references. I'm finding it a bit difficult to imagine that optimizations can make up for these; what am I overlooking?

• the language appears to encourage inner classes and inner functions. My sense of the community is that inner classes are now thought to be a code smell in C++ unless they're trivial functors or comparators. What am I overlooking?

• All top-level definitions are implicitly visible to clients -- private and protected members are coming in the future. No header files, no formal declaration of external interface. This strikes me as an odd choice for a language intended for moderately large and large systems. No doubt I'm simply missing a feature: what is it?

• The language has been touted for its performance, but it's not clear that it's been designed for runtime speed the way Go (say) was designed for compilation speed.  The language has been touted for its accessibility to younger programmers, but the book is clearly pitched to pros, the frameworks are certainly pitched to pros, and a language that features generics, tuples, and functional programming so prominently is not going to be especially easy to teach. What am I missing?

I'd welcome answers to the above -- many will be low-hanging fruit and I'm not at WWDC -- and would be interested to know what questions occur to my colleagues.

Mark Bernstein           bernstein@eastgate,com    (617) 924-9044
Eastgate Systems, Inc.   http://www.eastgate.com   (800) 562-1638
134 Main St.              
Watertown MA 02472 USA   http://markBernstein.org


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Swift
      • From: Jens Alfke <email@hidden>
    • Re: Swift
      • From: Drinktomi <email@hidden>
    • Re: Swift
      • From: Marco S Hyman <email@hidden>
  • Prev by Date: Re: Swift Headers (or lack of)
  • Next by Date: Re: swift and objective-c
  • Previous by thread: Re: Swift Headers (or lack of)
  • Next by thread: Re: Swift
  • Index(es):
    • Date
    • Thread