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

それは残像だ

yhara
June 29, 2019

 それは残像だ

yhara

June 29, 2019
Tweet

More Decks by yhara

Other Decks in Programming

Transcript

  1. ྫ todos = [ {id: 1, title: "ཛΛങ͏", done: false},

    {id: 2, title: "૟আػΛ͔͚Δ", done: false}, ] ͜͜ΛUSVFʹ͍ͨ͠ͱ͢Δ
  2. ୯७ʹ΍Δͱ͜͏ todos = [ {id: 1, title: "ཛΛങ͏", done: false},

    {id: 2, title: "૟আػΛ͔͚Δ", done: false}, ] todos[1][:done] = true ͜͜ΛUSVFʹ͍ͨ͠ͱ͢Δ
  3. todosΛॻ͖׵͑ͨ͘ͳ͍࣌͸ʁ todos = [ {id: 1, title: "ཛΛങ͏", done: false},

    {id: 2, title: "૟আػΛ͔͚Δ", done: false}, ] new_todos = todos.map{|x| if x[:id] == 2 x.merge(done: true) else x end } ͜͜ΛUSVFʹ͍ͨ͠ͱ͢Δ
  4. zanzouΛ࢖͏ͱ todos = [ {id: 1, title: "ཛΛങ͏", done: false},

    {id: 2, title: "૟আػΛ͔͚Δ", done: false}, ] require 'zanzou' new_todos = Zanzou.with_updates(todos) do |shadow_todos| shadow_todos[1][:done] = true } ͜͜ΛUSVFʹ͍ͨ͠ͱ͢Δ ˢʮ൪໨ͷEPOFΛUSVFʹ͢Δʯ͕ͦͷ··ॻ͚Δ ͔ͭΦϦδφϧ͸ແࣄ
  5. ྫɿશ෦ෳ੡ͯ͠͠·͑͹ಈ͚͘ Ͳ… UPEPT<>   OFX@UPEPT<>  5PEPJE  EPOFGBMTF

    5PEPJE  EPOFGBMTF 5PEPJE  EPOFGBMTF 5PEPJE  EPOFGBMTF 5PEPJE  EPOFGBMTF 5PEPJE  EPOFUSVF 5PEPJE  EPOFGBMTF 5PEPJE  EPOFGBMTF
  6. खॱ̍ɿϧʔτShadowΛ࡞Δ "SSBZ ΋ͱͷ ΦϒδΣΫτ ࢒૾ 4IBEPX )BTI )BTI  GBMTF

     GBMTF "SSBZ 4IBEPX   JE EPOF JE EPOF TIBEPX<><EPOF>USVF
  7. ઓུ̎ɿࢀর͞ΕͨΒShadowΛฦ͢ "SSBZ ΋ͱͷ ΦϒδΣΫτ ࢒૾ 4IBEPX )BTI )BTI  GBMTF

     GBMTF "SSBZ 4IBEPX   JE EPOF JE EPOF TIBEPX<><EPOF>USVF )BTI 4IBEPX
  8. ઓུ̏ɿॻ͖׵͑ΒΕͨΒͦͷ͜ͱΛ ͓֮͑ͯ͘ "SSBZ ΋ͱͷ ΦϒδΣΫτ ࢒૾ 4IBEPX )BTI )BTI 

    GBMTF  GBMTF "SSBZ 4IBEPX   JE EPOF JE EPOF TIBEPX<><EPOF>USVF )BTI 4IBEPX EPOFΛ USVFʹ͢Δ
  9. ઓུ̐ɿϑΝΠφϥΠζ "SSBZ ΋ͱͷΦϒδΣΫτ )BTI )BTI  GBMTF  GBMTF 

     JE EPOF J EPOF ࢒૾ "SSBZ )BTI EPOFΛ USVFʹ͢Δ "SSBZ ฦΓ஋ )BTI USVF   JE EPOF
  10. ઓུ̐ɿϑΝΠφϥΠζ "SSBZ ΋ͱͷΦϒδΣΫτ )BTI )BTI  GBMTF  GBMTF 

     JE EPOF J EPOF ࢒૾ "SSBZ )BTI EPOFΛ USVFʹ͢Δ "SSBZ ฦΓ஋ )BTI USVF   JE EPOF
  11. αϙʔτൣғ A. JSON࡞Δͷʹ࢖͏Α͏ͳΦϒδΣΫτ͸α ϙʔτ͍ͨ͠ • Hash, Array, String, ਺஋, true,

    false, nil B. ಠࣗΫϥε΋ઃఆΛ͢Ε͹࢖͑ΔΑ͏ʹ͍ͨ͠ C. ͲͷϝιουΛݺΜͰ΋େৎ෉ʹ͍ͨ͠
  12. αϙʔτ೉қ౓ 1. ਺஋, true, false, nil • immutable(ঢ়ଶΛ΋ͨͳ͍ʹมߋ͢Δ͜ͱ͕Ͱ͖ͳ͍)ͷͰ༨༟ 2. String

    • mutableͰ͸͋Δ͚ͲɺίϯςφͰ͸ͳ͍ͷͰ؆୯ 3. Hash • ίϯςφ(ଞͷΦϒδΣΫτΛࢠཁૉͱͯ͠΋ͭ)ͳͷͰগ͠େม 4. Array • ίϯςφ͔ͭɺΠϯσοΫε͕ͣΕΔέʔε͕͋ΔͷͰ࠷ѱ
  13. ·ͱΊ • ES6 Proxy͸͍͢͝ • Rubyͷsort()͸CͰ࣮૷͞Ε͓ͯΓɺͦͷ಺෦ಈ࡞͸ϑοΫͰ͖ ͳ͍ • جຊతͳέʔεͰ͸ಈ͍͍ͯΔ •

    ࢒Δέʔε͸pending specʹͯ͋͠ΔͷͰ୭͔௅ઓͯ͠΄͍͠ • 200ߦ͘Β͍ͳͷͰಡΜͰΈΔͱ໘ന͍͔΋ • https://github.com/yhara/zanzou