タグ

2010年10月30日のブックマーク (2件)

  • HTTP cookies, or how not to design protocols

    lcamtuf's old blog I retired this site back in 2022 for a couple of reasons. If you like the content, please subscribe to the new blog at lcamtuf.substack.com. For as long as I remember, HTTP cookies have been vilified as a grave threat to the privacy of online browsing. I don't quite agree, but I find the mechanism fascinating for another reason: it's a unique cautionary tale for engineers. Cooki

    okagawa
    okagawa 2010/10/30
  • モジュールとクラスの使い分け方 - osiire’s blog

    OCamlにはモジュールとクラスがあります。この二つの仕組みは、直感的によく似た機能を持っているので、どう使い分けたらいいのか迷う時があります。そこで、モジュールとクラスの使い分け方について少しまとめてみます。 基礎的なデータ/データ構造の場合 スタックとかキューとかグラフとか日付とか、内部構造を隠して操作だけを提供する、比較的基礎的な構造を作りたい場合です。この場合は、迷わずモジュールでいいです。ここをクラスにすると、バイナリメソッドで泣きます。 アプリケーションデータの場合 アプリケーション内で使う特定のデータ構造は、色々なデータの集合である事が多いので、大抵レコードになります。このレコードの代わりにクラスを使うのはありだと思います。逆に、これをモジュールでやると、内部型がないモジュールになって、オーバースペックな感じになります。もちろんレコードのままでいいなら、別にわざわざクラスにす

    モジュールとクラスの使い分け方 - osiire’s blog