Skip to content

Instantly share code, notes, and snippets.

View drewcrawford's full-sized avatar

Drew Crawford drewcrawford

View GitHub Profile
2014-02-21 21:14:25
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.65-b04-462 mixed mode):
"Attach Listener" daemon prio=9 tid=7f9e01000000 nid=0x10a7ae000 waiting on condition [00000000]
java.lang.Thread.State: RUNNABLE
"pool-2-thread-1" prio=5 tid=7f9dff1df800 nid=0x10b74c000 waiting on condition [10b74b000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <7f5ebac40> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
An alternative to semver
Major.minor.patch-tag
Major - For large, compatibility-breaking changes.
Minor - For features and fixes that are backwards compatible, as well as breaking changes that are "minor". This means breaking a small fraction of a large API, or breaking things that are simple to fix (like renaming a method, for example)
Patch - I only changed the bare minimum to fix an important bug or security issue
override func viewDidLoad() {
super.viewDidLoad()
var dict : [String: AnyObject] = [:]
dict[kSecClass] = kSecClassGenericPassword
dict[kSecMatchLimit] = kSecMatchLimitOne
dict[kSecReturnAttributes] = true
var rDict : Unmanaged<AnyObject>?
let status: OSStatus = SecItemCopyMatching(dict, &rDict)
if (rDict==nil) {
println("This behavior only in release mode.")
//
// RLMRealmDescription.swift
// DCAKit
//
// Created by Drew Crawford on 1/24/15.
// Copyright (c) 2015 DrewCrawfordApps. All rights reserved.
//
import Foundation
import Realm
/** An example statically-dispatched, trait-based recursive datastructure in Rust */
/**A master trait */
trait Link {
fn value(&self) -> i32;
fn next(&self) -> Option<&Link>;
fn sumOfValue(&self)->i32 {
let maybeNext = self.next();
match maybeNext {
Some(v) => {
import Foundation
let notification = "MyNotification"
struct DontCopy {
var value = false
mutating func whatever(#callback:() -> ()) {
self.value = true
NSNotificationCenter.defaultCenter().addObserverForName(notification, object: nil, queue: nil) { (noti) -> Void in
//: Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
import Foundation
class POSIXSocketNotificationHandle { }
protocol Nextable {

This, is actually the wrong conclusion. The entire purpose of the “inner class” is to provide value semantics while maintaining effeciency of implementation.

Is that an opinion? Or was there a meeting when the "entire purpose" of inner classes was established and I wasn't invited? Sure, they can be used for efficiency, but they can also be used for other purposes, including inner mutation.

Just for starters, Mike Ash seems to have uncovered that inner classes are used inside the standard library to provide destructors:

Destruction can be solved by using a class, which provides deinit. The pointer can be destroyed there. class doesn't have value semantics, but we can solve this by using class for the implementation of the struct, and exposing the struct as the external interface to the array.

So to say that the "entire purpose" of inner classes is efficiency is I think plainly false; they are used for many reasons. E

swift: /swift-dev/swift/include/swift/AST/Decl.h:2160: swift::Accessibility swift::ValueDecl::getFormalAccess() const: Assertion `hasAccessibility() && "accessibility not computed yet"' failed.
0 swift 0x00000000033bff78 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x00000000033be716 llvm::sys::RunSignalHandlers() + 54
2 swift 0x00000000033c0b7a
3 libpthread.so.0 0x00007efc6ef0b8d0
4 libc.so.6 0x00007efc6d8f0067 gsignal + 55
5 libc.so.6 0x00007efc6d8f1448 abort + 328
6 libc.so.6 0x00007efc6d8e9266
7 libc.so.6 0x00007efc6d8e9312
8 swift 0x0000000000ce19e7
/usr/bin/clang++ -ldl -lpthread -lbsd -licui18n -licuuc /swift-dev/build/Ninja-ReleaseAssert/swift-linux-x86_64/lib/swift/linux/x86_64/swift_begin.o /tmp/test2-9cbb9a.o -L /swift-dev/build/Ninja-ReleaseAssert/swift-linux-x86_64/lib/swift_static/linux --target=x86_64-unknown-linux-gnu -Xlinker -rpath -Xlinker /swift-dev/build/Ninja-ReleaseAssert/swift-linux-x86_64/lib/swift_static/linux -lswiftCore @/tmp/test2-49baa1.autolink /swift-dev/build/Ninja-ReleaseAssert/swift-linux-x86_64/lib/swift/linux/x86_64/swift_end.o -o test2