This file contains hidden or 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
#!/bin/bash | |
set -e | |
if [[ $# -lt 1 ]]; then | |
echo "Not enough arguments?!" | |
echo "$0 <hash1> ... <hashN>" | |
exit 1 | |
fi |
This file contains hidden or 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
// # Why +0 is a better default than +1 for "normal function arguments". | |
// | |
// My intention here is to show why +0 is better default in a resilient | |
// word. Keep in mind that inside individual modules and with inlinable | |
// declarations, the optimizer can change conventions at will so from a defaults | |
// perspective, these are not interesting. The interesting case is calling | |
// non-inlinable functions in other modules. | |
// | |
// Consider a situation where I have a class Klass and a function foo that calls | |
// a function bar in a different module. |
This file contains hidden or 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() { | |
var x: (Int, Int) | |
x.0 = 0 | |
print(x.0) // <--- This works | |
let capture = { | |
print(x.0) // <--- This doesn't | |
} | |
} |
This file contains hidden or 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
## // xcrun clang++ test.cpp -O3 -o - -S -std=c++11 -mavx | |
.section __TEXT,__text,regular,pure_instructions | |
.macosx_version_min 10, 13 | |
.globl __Z7equalP2PDv8_tDv16_h ## -- Begin function _Z7equalP2PDv8_tDv16_h | |
.p2align 4, 0x90 | |
__Z7equalP2PDv8_tDv16_h: ## @_Z7equalP2PDv8_tDv16_h | |
.cfi_startproc | |
## BB#0: | |
pushq %rbp |
This file contains hidden or 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 | |
typealias CallbackBlock = @convention (block) () -> Void | |
func main() -> CallbackBlock { | |
let handler: CallbackBlock = { print("yes") } | |
let x = NSMutableDictionary() | |
x["foo"] = handler | |
let handler2 = x["foo"] as! CallbackBlock | |
return handler2 |