Welcome, Guest. Please login or register.

Author Topic: The Swift Progamming Language...  (Read 7832 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline RedskullDC

  • Full Member
  • ***
  • Join Date: Sep 2003
  • Posts: 136
    • Show all replies
Re: The Swift Progamming Language...
« on: June 03, 2014, 10:02:24 AM »
Hi Bloodline, et al.

Just had a bit of a thumb through the swift guide.
Here: https://itunes.apple.com/us/book/swift-programming-language/id881256329
for anyone interested. Free download.

Initial thoughts:

1. Type Safety vs. Type Inference

I don't think you can have it both ways.
Inference makes it easier on the programmer, but also allows subtle bugs to creep in.
Did some work recently in RUBY where this became an issue.

Or maybe I have just spent too long programming in VHDL :)

2. Tuples
Seems like a nice idea for functions to be able to return compound values without the overhead of creating a class definition.

3. Property Observers
Could be handy to trigger a function when a property is changed.
Presumably this will work across threads?
Guide doesn't go into that level of detail.

4. Extensions
"Extend types for which you do not have access to the original source code"
Can you say security hole?
I couldn't see any way of preventing Extensions?
(It wasn't clear to me whether the 'final' attribute blocks this functionality?)

5. Generics
Good. Enough said.

6. Custom Operators
Good. Enough said.

7. No Pointers?
Makes hardware bashing rather difficult.
It may be possible to import modules/functions written in other languages which do though?
The "import (import kind)" isn't very clear on this

Seems to have borrowed a few ideas from other languages, and renamed them for no good reason:

Closures <=> Lambdas (Java,Ruby etc.)

I agree, the Obj-C syntax can be rather quirky.

---

Will have to wait and see the release version before passing final judgement...

Cheers,
Red
Redskull @ Digital Corruption
A500, 4000/060-75MHz
WinUAE on Windows7-X64Ult
Minimig DE1
-------------------------