雑なメモ。 そのうちフォーマットしてブログにまとめる予定。
内容は 2017-10-14 およびそれ以前の情報に基く。
過去のこのファイルの内容にはいくらかのミスや古くなった内容などがあるため、内容を更新しつつブログに書き直した。 Rust での never type とセミコロン、型推論のルール変遷 - 何とは言わない天然水飲みたさ を参照されたい。
雑なメモ。 そのうちフォーマットしてブログにまとめる予定。
内容は 2017-10-14 およびそれ以前の情報に基く。
過去のこのファイルの内容にはいくらかのミスや古くなった内容などがあるため、内容を更新しつつブログに書き直した。 Rust での never type とセミコロン、型推論のルール変遷 - 何とは言わない天然水飲みたさ を参照されたい。
| /*: | |
| This is an implementation of Algorithm W, as found in [Principal Types for functional programs](http://web.cs.wpi.edu/~cs4536/c12/milner-damas_principal_types.pdf). | |
| We'll start by defining literals and expressions: | |
| */ | |
| enum Literal { | |
| case string(String) | |
| case int(Int) |
| object LengauerTarjan { | |
| // Implement these three yourself | |
| def successors(v: Int): Iterable[Int] = ??? | |
| def predecessors(v: Int): Iterable[Int] = ??? | |
| def numNodes: Int = ??? | |
| // Lifted from "Modern Compiler Implementation in Java", 2nd ed. chapter 19.2 | |
| def computeDominatorTree(): Array[Int] = { | |
| var N = 0 |
| /// 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 |
| // | |
| // Operators.swift | |
| // FastParsing | |
| // | |
| // Created by Chris Eidhof on 26/12/2016. | |
| // Copyright © 2016 objc.io. All rights reserved. | |
| // | |
| // TODO: give appropriate credit. Many parts were stolen from SwiftParsec. |
| # The trick is to link the DeviceSupport folder from the beta to the stable version. | |
| # sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
| # Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
| sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
| # Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
| # (A similar approach works for older versions too, just change the version number after DeviceSupport) |
| % 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 |