#Every Single Option Under The Sun
- optimization level options
- automatic crashing options
- debug info options
- swift internal options
- swift debug/development internal options
- linker-specific options
- mode options
| #ident "@(#) Object.h, Rev 2.10, 96/08/02" | |
| // | |
| // Copyright (c) 1995-1996, Sun Microsystems, Inc. | |
| // portions (c) Copyright 1988, 1989 NeXT, Inc. | |
| // All rights reserved. | |
| #ifndef _OBJC_OBJECT_H_ | |
| #define _OBJC_OBJECT_H_ | |
| #import <objc/objc.h> |
| /// Playground - noun: a place where people can play | |
| /// I am the very model of a modern Judgement General | |
| //: # Algorithm W | |
| //: In this playground we develop a complete implementation of the classic | |
| //: algorithm W for Hindley-Milner polymorphic type inference in Swift. | |
| //: ## Introduction |
| // Playground - noun: a place where people can play | |
| // I wouldn't want a pair of birds that were... too demonstrative. | |
| func idiot<A>(a : A) -> A { | |
| return a | |
| } | |
| func kestrel<A, B>(a : A) -> B -> A { | |
| return { _ in a } |
#Every Single Option Under The Sun
| final class Nat<F> : FunctorOf<F> { | |
| let pred : Optional<F> | |
| override init() { | |
| self.pred = nil | |
| } | |
| init(pred : F) { | |
| self.pred = pred | |
| } |
Swift’s type system supports a number of different ways of taking a function or type and abstracting it. Usually, this is done by adding a generic parameter and an associated set of constraints. Similarly, a function that takes a particular type of argument can be abstracted to any number of those arguments by making it variadic with triple-dot (...) syntax. Today, both of these features are permitted separately: you can define a generic function that takes a variable number of arguments, such as
func debugPrint<T>(_ items: T...)
where T: CustomDebugStringConvertible
{
for (item: T) in items {
stdout.write(item.debugDescription)| // | |
| // Free.swift | |
| // Swift_Extras | |
| // | |
| // Created by Robert Widmann on 9/19/14. | |
| // Copyright (c) 2014 Robert Widmann. All rights reserved. | |
| // | |
| import Foundation |
| #if canImport(Darwin) | |
| import Darwin | |
| #elseif canImport(Glibc) | |
| import Glibc | |
| #else | |
| #error("unsupported platform") | |
| #endif | |
| /// Core utilities for interacting with IP-based abstractions. | |
| public struct IP { |
| // cc aviary.m -o aviary -framework Foundation -fobjc-arc && ./aviary | |
| #import <Foundation/Foundation.h> | |
| // use it like lambda(…args…)(…return value…) | |
| #define lambda(...) \ | |
| ^ (__VA_ARGS__) _lambda_body | |
| #define _lambda_body(...) \ | |
| { return __VA_ARGS__; } |