Swift2 smalltalk osxdev

42
twitter.com/ @godrm facebook.com/ godrm func swift(?)->(!) { return (“version”, 2) } OSXDEV .org

Transcript of Swift2 smalltalk osxdev

twitter.com/@godrmfacebook.com/godrm

� �func swift(?)->(!) { return (“version”, 2) }

OSXDEV.org

swift-lang.org

WWDC Swift Panel meetup

https://realm.io/news/apple-wwdc-2015-swift-panel-discussion/

Namespace

Closures

.map.reduceGenerics

inferred typeBridging

Protocol

Initialization

Operators

Strings and Char

Enumerations

Class & Structures

OptionalARC

Currying

App

Per

form

ance

Developer Productivity

CC++

Objective-CJava

RubyPython

JavaScriptGroovyLuaPerl

Improved option sets

Markdown in comments

Objective-C generics Nullability in Objective-C

Faster debug mode

C function pointer APIs

Parallelized WMO

guard

defer

do { }

Synthesized “headers” in Xcode

SIMD supportPattern matching in "if"

Swift 1.2 to 2.0 Migrator @testable

Protocol extensions

Availability checking

Error Handling Model

Multi-payload enums

Recursive nested functions

Faster runtime

Shorter compile time New playgrounds

Mutability warnings

Lisp, Prolog FORTRAN, ALGOLSimula

SmalltalkCObjective-C, C++

JavaPython

C#

Pascal

ErlangHaskell

Scheme

Clojure

Two Paradigms

1950’s

1960’s1970’s

1980’s

1990’s

2000’s

Pure Objective

aPen

+new

+red

+blue

,moveTo:

,draw

,color:

positioncolor

객체구별자 (identifier)Pen:객체

2011년 3월

“Object-oriented programming is eliminated entirely from the introductory curriculum, because it is both anti- modular and anti-parallel by its very nature, and hence unsuitable for a modern CS curriculum. A proposed new course on object-oriented design methodology will be offered at the sophomore level for those students who wish to study this topic.” - Robert Harper, professor at CMU

CMU CS 개론 수업에서 OOP 퇴출

Output

Input

Memory

Variables

Pure Functional

순수한 함수★ 부작용(side-effect)이 없는 함수

★ 변경 불가한 데이터 (Immutability)

★ 참조 투명성 (referential transparency)

★ 게으른 평가 (lazy Evaluation)

★ 타입 클래스 (type class)

★ 고계 함수 (high-order function)

Lisp, Prolog FORTRAN, ALGOLSimula

SmalltalkObjective-C, C++

JavaPython

C#

Kotlin, SwiftRust

Scala

Scheme

F#Ruby

DClojureJulia

JS

1950’s

1960’s1970’s

1980’s

1990’s

2000’s2010’s

Two Paradigms

CPascal

ErlangHaskell

CPU 발전 추세

운영체제

하드웨어

Runtime

Swift App.

Swift App.

Runtime

Obj-C App.

Obj-C App.

Swift vs Objective-C Runtime

Swift Library v1.0✴ libswiftAppKit.dylib* ✴ libswiftCoreGraphics.dylib* ✴ libswiftDarwin.dylib* ✴ libswiftDispatch.dylib* ✴ libswiftFoundation.dylib* ✴ libswiftObjectiveC.dylib* ✴ libswiftSpriteKit.dylib* ✴ libswiftXCTest.dylib* ✴ libswift_runtime.a ✴ libswift_stdlib_core.dylib*

Swift Library v2.0

✴ libswiftAppKit.a ✴ libswiftCoreGraphics.a ✴ libswiftDarwin.a ✴ libswiftDispatch.a ✴ libswiftFoundation.a ✴ libswiftObjectiveC.a ✴ libswiftSpriteKit.a ✴ libswiftXCTest.a ✴ libswift_runtime.a

libswiftAVFoundation.a libswiftCloudKit.a libswiftContacts.a libswiftCore.a libswiftCoreAudio.a libswiftCoreBluetooth.a libswiftCoreData.a libswiftCoreImage.a libswiftCoreLocation.a libswiftCoreMedia.a libswiftEventKit.a libswiftGLKit.a libswiftGameCenter.a libswiftGameplayKit.a libswiftLocalAuthentication.a libswiftMultipeerConnectivity.a libswiftOpenCL.a libswiftSceneKit.a libswiftWebKit.a libswiftsimd.a

Swift OverviewThe Basics

Protocol-Oriented Programming in SwiftSession 408

#WWDC 2015Development Tools

Dave Abrahams | Professor of Bowling-Your-Mind

• Encapsulation• Access Control• Abstraction• Namespace• Expressive Syntax• Extensibility

Classes Are Awesome

Classes Are Awesome

•Encapsulation • Access Control • Abstraction • Namespace • Expressive Syntax • Extensibility

ClassesClassesClassesTypes

I can do allthat with structs

and enums.

Value Type vs. Reference TypeCall by value, Call by reference

Classes That Do Not Contain References

Reference Reference Reference Reference

Point Point Point Point

Array

class Point { var x, y: Float

}

}

for p in array {...

var array: [Point] = ...

var x, y: Float struct Point {

Structs That Do Not Contain References

Array

for p in array {

}...

var array: [Point] = ... Point Point Point Point

}

All reference counting operations eliminated

어떤 언어로 만들까?

TOIBE Index (Dec. 2015)

Swift

아직도 beta 버전?!

OSI-approved license

Later this year

Code contributions accepted

swift.org

github.com/apple

Platform https://swift.org/download/

Core Libraries

✴ swift-corelibs-foundation ✴ http://www.github.com/apple/swift-corelibs-foundation

✴ swift-corelibs-libdispatch ✴ http://www.github.com/apple/swift-corelibs-libdispatch

✴ swift-corelibs-xctest ✴ http://www.github.com/apple/swift-corelibs-xctest

Package Manager✴ Swift-package-manager

✴ https://github.com/apple/swift-package-manager

✴ swift-build

import PackageDescription

let package = Package( name: "Dealer", targets: [], dependencies: [ .Package(url: "https://github.com/apple/example-package-deckofplayingcards.git", majorVersion: 1), ])

https://github.com/apple/swift-llbuild

REPL & Debugger✴ Integrated debugging

✴ LLDB

Community

✴ Communication ✴ Mailing Lists, github, bugs.swift.org

✴ Structure ✴ Project lead, core team, code owner, committer,

contributor

✴ Contributing & Proposing New Features

https://swift.org/community/