Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2020 - COSCUP - 你這段 Ruby Code 超速摟,已經沒有人看得懂了!

2020 - COSCUP - 你這段 Ruby Code 超速摟,已經沒有人看得懂了!

蒼時弦や

August 02, 2020
Tweet

More Decks by 蒼時弦や

Other Decks in Technology

Transcript

  1. 你這段 Ruby Code 超速摟,
    已經沒有人看得懂了!

    View Slide

  2. WEB DEVELOPER
    GAME DEVELOPER


    ݭ໵
    @elct9620

    View Slide

  3. View Slide

  4. https://oktop.tumblr.com/

    View Slide

  5. DSL
    @topic[0]

    View Slide

  6. View Slide

  7. 針對 特定情境 所設計的語言

    View Slide

  8. Meta Programming
    @topic[1]

    View Slide

  9. View Slide

  10. 對語言的 拓展 進而改善開發效率

    View Slide

  11. View Slide

  12. DSL 是實現 Meta Programming 的 手段 之一

    View Slide

  13. Make a DSL by yourself
    @topic[2]

    View Slide

  14. View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. View Slide

  19. Create your meta programming
    @topic[3]

    View Slide

  20. View Slide

  21. View Slide

  22. View Slide

  23. View Slide

  24. View Slide

  25. The "eval" way
    @topic[4]

    View Slide

  26. 比較 特殊 的用法,但可能意外常見

    View Slide

  27. View Slide

  28. View Slide

  29. View Slide

  30. Unlight - Code Generator
    @topic[5]

    View Slide

  31. View Slide

  32. View Slide

  33. View Slide

  34. View Slide

  35. 為什麼要 動態 產生方法?

    View Slide

  36. Length (2 Byte)
    Command (2 Byte)
    Body
    "\n" (1 Byte)

    View Slide

  37. Number (4 Byte)
    Char (1 Byte)
    String
    Boolean (1 Byte)
    Length

    View Slide

  38. View Slide

  39. View Slide

  40. View Slide

  41. 這樣做有什麼 好處 ?

    View Slide

  42. View Slide

  43. Unlight - Meta Programming
    @topic[6]

    View Slide

  44. View Slide

  45. View Slide

  46. View Slide

  47. View Slide

  48. View Slide

  49. 這樣做有什麼 好處 ?

    View Slide

  50. View Slide

  51. Q&A

    View Slide

  52. Thanks

    View Slide