今週のまとめ
- [プログラミング言語] Ruby の JIT
- mrubyのJITの概要 - Qiita mruby の JIT についてのリンク集
- VMに手を加えずRubyを高速化するJITコンパイラ「YARV-MJIT」の話 - k0kubun's blog
- [プログラミング言語] GitHub - Microsoft/napajs: Napa.js: a multi-threaded JavaScript runtime
- JSのマルチスレッドライブラリ
- Node.js の Cluster に対し、メモリ共有をサポートしているとのこと
- Intro: https://github.com/Microsoft/napajs/wiki/introduction
- [プログラミング言語] Hotswapping Haskell · Simon Marlow
- Haskell プラットフォームでホットスワッピング (Hot code reloading) を行う
- [プログラミング言語] The Zig Programming Language
- AltC 言語
- Rust よりも機能は少なめのように感じた
- [数学] GitHub - hmemcpy/milewski-ctfp-pdf: Bartosz Milewski's 'Category Theory for Programmers' unofficial PDF and LaTeX source
- Bartosz Milewski 氏のブログ記事 "Category Theory for Programmers" の PDF 版
- CCなので非公式でこういうことができるの便利
- [セキュリティ] Introducing Miscreant: a multi-language misuse resistant encryption library
- GitHub - miscreant/miscreant: Misuse-resistant symmetric encryption library supporting the AES-SIV (RFC 5297) and CHAIN/STREAM constructions
- AES-CTR のような使い方を間違えて脆弱になるような暗号があるが、そのような誤用に対する耐用性がある暗号 AES-SIV など *1 の実装
- AES-SIV の 日本語の解説記事はここ RFC 5297 AES-SIV モード - Tociyuki::Diary
- [プログラミング言語] 一階の単一化を証明する (PDF)
- [その他] BOOLR | A digital logic simulator
*1: 他のは実装中?
まとめ : Algebraic Effects and Handlers とか
- [プログラミング言語] Recursion Schemes, Part IV: Time is of the Essence
- explains Recursion Schemes, especially futumorphism and histomorphism
- 2年前に書いた dynamorphism の記事も参照 手前味噌 http://45deg.github.io/rogyAdC2015/
- [プログラミング言語] GitHub - Marwes/haskell-compiler: A mostly functional haskell compiler written in rust
[プログラミング言語] Algebraic Effects and Handlers
-
Algebraic effects and handlers provide a modular abstraction for expressing effectful computation, allowing the programmer to separate the expression of an effectful computation from its implementation.
*1- a more modular alternative to monads という人もいたりする。
- Haskeller にとっては Freer モナドでおなじみですね。
- シンプルな例 (擬似コード、Effでの例 → https://gist.github.com/45deg/055cd32e8723ead25a64d8256f292f03)
-
printName = { name <- readLine; print ("hello " . name) }
という副作用のあるプログラム(関数)があったとする。 - ここで
inputJohn = fun e -> match e with readLine () k -> (k "John")
*2 という handler を定義する。これは副作用を制御する関数 (handler)である。- k は継続で元の呼び出し部に帰る。これを discard すれば呼び出し部には戻らない。
- Multicore OCaml 等だと
continue k "John"
という呼び出しをする。
-
handle printName with inputJohn
のように組み合わせるように記述する。この場合 キーボードの入力はされずに "hello john" という文字列が即座に出力される。 - つまり 副作用のあるコードの表現 (the expression of an effectful computation) とその(副作用の)実際の実装 (its implementation)を分離して記述することが出来る抽象化の手法である。
-
- より詳しい例は GitHub - ocamllabs/ocaml-effects-tutorial: Concurrent Programming with Effect Handlers (CUFP'17) が詳しい (OCaml)。演習問題付き。
- 言語: Eff, Koka, Multicore OCaml など
- Multicore OCaml は fiber (coroutine) が concurrency primitive になってるっぽい https://www.cl.cam.ac.uk/~sd601/papers/multicore_slides.pdf
- 参考文献リスト: GitHub - yallop/effects-bibliography: A collaborative bibliography of work related to the theory and practice of computational effects
- 中でも An Introduction to Algebraic Effects and Handlers (MFPS 2015) は入門記事っぽくておすすめ http://www.eff-lang.org/handlers-tutorial.pdf
- 個人的にはテストの時便利そうだなと思った。( IO 等の mock として handler が有効活用できそう )
*1: Effective Concurrency with Algebraic Effects · KC Sivaramakrishnan
*2:e: effect, readLine : unit -> continuation -> unit
まとめ
- [Haskell] Building a CPU with Haskell - Part 1 :: Will Yager
- [Go][モバイル] Matcha - Mobile apps in Go
- [JavaScript] GitHub - cherow/cherow: A fast, Typescript-based ECMAScript parser
- JavaScript 製の ECMAScript パーサ
- パフォーマンスに重点を置いているらしい → Cherow: Speed Comparisons
- [数学] HoTTSQL
- WebSite: Cosette: An Automated SQL Solver
- Paper: https://arxiv.org/abs/1607.04822
- 解説ブログ
- Homotopy Type Theory (ホモトピー型理論)の実用アプリケーション
- アプリは SQL の Equivalence をチェックするツール
- yabai
まとめ
- [ソフトウェア] Uber Open Source - Jaeger
- [アルゴリズム] Pipe Logic
- MOSFET素子を模した実行ファイルとその間のパイプIOで回路っぽいものを作る
- [JavaScript] Jalangi - A Dynamic Analysis Framework for Frontend and Backend JavaScript
- JSのための動的解析ツール
- コードインジェクションしてるっぽい
- [JavaScript] Passport
- Node.js 向けの認証ミドルウェア
- 有名だけど備忘録として
- [OCaml] GitHub - inhabitedtype/angstrom: Parser combinators built for speed and memory efficiency
- OCaml 向けのモナディックパーサ
- 有名だけど(略)
ひとこと:メタプログラミングRuby読んでるけど、この本が優れているのはいかにメタプログラミングをまともなエンジニアリングに組み込むかが主眼になっているということだと思う。単なる Ruby はこんな書き方できるんですよ、変でしょ?で終わってない点がこの本が評価されているゆえんなのかなと思っている。
追記:言語やツールについてのカンファレンスである StrangeLoop というのが最近開かれたらしく、動画がいくつか上がっていた
まとめ (消化)
何週間も更新してないけど特にネタを蓄積したわけでもない。 とりあえずメモに残っていたぶんを放出
- [セキュリティ] Reverse Engineering Malware 102 | Malware Unicorn
- マルウェアの解析(RE)を step-by-step で解説
- How Does a Database Work? | Let’s Build a Simple Database
- http://bittorrent.org/beps/bep_0052.html
- ビットトレントの仕様
- https://aphyr.com/tags/jepsen
- 分散システムのベリフィケーションツールの Jepsen を real-world な例に適用してできた豊富な屍の山。こんなに成果出ると楽しいだろうなぁ
- [プログラミング言語] higher-order-unification/explanation.md at master · jozefg/higher-order-unification · GitHub
- higher-order unification を行う Huet’s algorithm の Haskell 実装での解説
Docker 内で radare2 を使うとき ptrace-traceme: Operation not permitted が出る問題
TL;DR: You must pass --security-opt seccomp:unconfined
when running a container.
クールなリバースエンジニアリングフレームワーク radare は、公式で docker イメージを提供しているので手軽に試すことが出来る。
しかし、デバッグモードで実行しようとすると以下のようなエラーが発生することがある。
r2@39573811ef24:~$ ls hello hello.c r2@39573811ef24:~$ r2 -d hello ptrace-traceme: Operation not permitted Cannot open 'dbg://./hello' for writing.
結論から言うと Docker のセキュリティ機構 *1 が影響しているので docker run
時に無効にする必要がある。
docker run --security-opt seccomp:unconfined --rm -it radare/radare2
参考: https://github.com/moby/moby/issues/20064
*1: システムコールに制限をかける seccomp https://blog.docker.com/2016/02/docker-engine-1-10-security/
今週のまとめ (2017/08/04)
- [プログラミング言語] DI:依存性注入ライブラリを自分で作ろう // Speaker Deck
- Dependency Injection を ステップバイステップで実装を見ていくスライド。スライドはコードが大半を占めている。おそらく Dagger の解説であると思われる。
- [プログラミング言語] PureScript by Example – 8. The Eff Monad
- Haskell-like な AltJS である PureScript における Eff Monad (Extensible Effects) の事例
- レポジトリは ここ
- 知らなかったが、PureScript のライブラリは面白そうなものが多い、Lensとか… → https://pursuit.purescript.org/
- [機械学習][プログラミング言語] GitHub - Netflix/vectorflow
- Netfilx が開発した D言語によるニューラルネットワークのフレームワーク。
- [機械学習] [R] 計量経済学と機械学習の違い - ill-identified diary