Previously, Trill used the TinyGC garbage collector to manage memory allocated by indirect types. This garbage collector, though able to clean up these heap structures, does not afford the ability to introspect a data structure for its references, which is necessary to implement Copy on Write. As such, we have elected to move to an Automatic Reference Counting model for automatically managing the allocation of indirect types in the Trill language.
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
use std::env; | |
fn print_spongebob(vals: &[String]) { | |
let statement = vals.join(" "); | |
let mut lower = true; | |
for c in statement.chars() { | |
let new_c = if lower { c.to_lowercase().next() } | |
else { c.to_uppercase().next() }; | |
if let Some(c) = new_c { | |
print!("{}", c); |
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
#!/usr/bin/env swift | |
import EventKit | |
let eventStore = EKEventStore() | |
extension String: Error {} | |
func deleteBadEvents(calendarName: String) throws { | |
// Make dates for Fall Semester 2017 before exams |
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
Definition bind_option (A: Type) (B: Type) (opt: option A) (f: A -> option B): option B := | |
match opt with | |
| Some v => f v | |
| None => None | |
end. | |
Definition return_option (A: Type) (a: A) := Some a. | |
(* return a >>= f = f a *) | |
Theorem left_identity_option A B a f: |
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
Require Import String Arith List Bool Ascii. | |
Scheme Equality for string. | |
(* | |
* The Simply-Typed Lambda Calculus | |
*) | |
(* | |
* Two base types: | |
* - Integers (natural numbers) |
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 | |
import SwiftSyntax | |
func main() throws { | |
guard CommandLine.arguments.count > 1 else { | |
print("usage: swift-format [file]") | |
exit(-1) | |
} | |
let url = URL(fileURLWithPath: CommandLine.arguments[1]) |
I hereby claim:
- I am harlanhaskins on github.
- I am harlanhaskins (https://keybase.io/harlanhaskins) on keybase.
- I have a public key ASAaLSbIdUmM-i3WHBBB-TdELlHJc_NXNetHa6sBSxxqzAo
To claim this, I am signing this object:
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
#include <Arduino.h> | |
#ifndef ARDUINO_UTILS_H | |
#define ARDUINO_UTILS_H | |
/// DigitalPin is a base class for digital I/O pins. On its own, it just | |
/// declares the data layout -- it's up to subclasses to implement features | |
/// that are specific to input or output. | |
class DigitalPin { | |
protected: |
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 | |
enum Result<Value> { | |
case success(Value) | |
case failure(Error) | |
func promote() throws -> Value { | |
switch self { | |
case .success(let value): | |
return value |
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
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -module-name NIOOpenSSL -incremental -emit-dependencies -emit-module -emit-module-path /Users/harlan/Code/Swift/WWDC-Photohunt/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.swiftmodule -output-file-map /Users/harlan/Code/Swift/WWDC-Photohunt/.build/x86_64-apple-macosx10.10/debug/NIOOpenSSL.build/output-file-map.json -parse-as-library -num-threads 8 -c /Users/harlan/Code/Swift/WWDC-Photohunt/.build/checkouts/swift-nio-ssl.git-1370587408992578247/Sources/NIOOpenSSL/IdentityVerification.swift /Users/harlan/Code/Swift/WWDC-Photohunt/.build/checkouts/swift-nio-ssl.git-1370587408992578247/Sources/NIOOpenSSL/OpenSSLClientHandler.swift /Users/harlan/Code/Swift/WWDC-Photohunt/.build/checkouts/swift-nio-ssl.git-1370587408992578247/Sources/NIOOpenSSL/OpenSSLHandler.swift /Users/harlan/Code/Swift/WWDC-Photohunt/.build/checkouts/swift-nio-ssl.git-1370587408992578247/Sources/NIOOpenSSL/OpenSSLServerHandler.swift /Users/harlan/C |