Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save buzztaiki/a0f26531c4f7f2cefe86910e8a30d651 to your computer and use it in GitHub Desktop.
Save buzztaiki/a0f26531c4f7f2cefe86910e8a30d651 to your computer and use it in GitHub Desktop.

みんな名前違って毎回わすれる

名前

  • アノテーション (Annotation): Java, Scala, Kotlin
  • デコレータ (Decorator): Python, JS, TS
  • 属性 (Attribute): C#, Rust, PHP

使われかた

  • Java の仲間のアノテーションは Annotation Processor でコード生成したり、リフレクションしたり、バイトコード変換したりする。
  • Pytohn, JS, TS のデコレータの実態は高階関数。対象の関数やクラスを引数に適用してから名前を付ける。
  • Rust のは大体手続きマクロで処理される。
  • C# のは分からないけど Java っぽそう。
  • PHP は全然分からない。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment