This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% swiftc -Xllvm -help-hidden /tmp/foo.swift | |
USAGE: swift (LLVM option parsing) [options] | |
OPTIONS: | |
-a9-754319-workaround - Enable workarounds for A9 HW bugs #754319 | |
-a9-754320-workaround - Enable workarounds for A9 HW bugs #754320 | |
-aarch64-use-tbi - Assume that top byte of an address is ignored | |
-agg-antidep-debugdiv=<int> - Debug control for aggressive anti-dep breaker | |
-agg-antidep-debugmod=<int> - Debug control for aggressive anti-dep breaker | |
-aggressive-ext-opt - Aggressive extension optimization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func foo(f:()->(Int?)) { | |
println(f()) | |
} | |
let bar : ()->Int = { 3 } | |
// foo shouldn't be able to take bar, should it? | |
foo(bar) // prints Optional(3) | |
// you're freaking me out, Swift. Did it allocate a wrapping closure? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The Y combinator in Swift! | |
For a discussion of what the heck this is all about, see http://www.ece.uc.edu/~franco/C511/html/Scheme/ycomb.html | |
The nifty thing is that it allows us to implement recursion without the ability for a function to refer to itself from within its own definition. | |
Note how we manage a recursive definition of factorial without any function referring to its own name. | |
Thanks to @eridius for help with the SelfToUnderlying<T> type. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Get strings descriptions for enum values for debugging. | |
Usage: | |
With enum | |
typedef enum { | |
AppleFruit = 0, | |
BlueberryFruit = 1, | |
BlackberryFruit = -1 | |
} Fruit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func foo() { | |
func bar(x:Int)->String { | |
return "hello" | |
} | |
[1,2,3].map({bar($0)}) // "Cannot reference a local function from another local function" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JButton button; | |
Container contentPane = getContentPane(); | |
GridBagLayout gridbag = new GridBagLayout(); | |
GridBagConstraints c = new GridBagConstraints(); | |
contentPane.setLayout(gridbag); | |
c.fill = GridBagConstraints.HORIZONTAL; | |
button = new JButton("Button 1"); | |
c.weightx = 0.5; | |
c.gridx = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#define KVCKeyPath_1(a) @"" a | |
#define KVCKeyPath_2(a, ...) a @"." KVCKeyPath_1(__VA_ARGS__) | |
#define KVCKeyPath_3(a, ...) a @"." KVCKeyPath_2(__VA_ARGS__) | |
#define KVCKeyPath_4(a, ...) a @"." KVCKeyPath_3(__VA_ARGS__) | |
#define KVCKeyPath_5(a, ...) a @"." KVCKeyPath_4(__VA_ARGS__) | |
#define KVCKeyPath_6(a, ...) a @"." KVCKeyPath_5(__VA_ARGS__) | |
#define KVCKeyPath_7(a, ...) a @"." KVCKeyPath_6(__VA_ARGS__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[log] V:[a(==b)] | |
VALID | |
[log] V:|-(7)-[a]-(7)-| | |
VALID | |
[log] V:|-20@750-[a]-10@45-| | |
VALID | |
[log] V:|-m-[a(n)]-(>=o)-[b] | |
Unable to parse constraint format: | |
Options mask required views to be aligned on a vertical edge, which is not allowed for layout that is also vertical. | |
V:|-m-[a(n)]-(>=o)-[b] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class Hrm { | |
@objc func objcFunc() { | |
} | |
dynamic func dynamicFunc() { | |
} | |
func normalFunc() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Value : Equatable { | |
} | |
protocol Smashable { | |
typealias TargetValue : Value | |
func valueBySmashingOtherValue<SomeOtherValue : Value>(value: SomeOtherValue) -> TargetValue | |
} | |
struct Bar : Value { | |
} |
NewerOlder