改めて学ぶContracts

1821636ac95415aa6e84bc33b394283d?s=47 tommykw
August 24, 2019

 改めて学ぶContracts

1821636ac95415aa6e84bc33b394283d?s=128

tommykw

August 24, 2019
Tweet

Transcript

  1. 3.
  2. 7.

    ˞ʮӾཡ਺ʯʮར༻ऀ਺ʯ͸ϝσΟΞͱΞϓϦͷ߹ܭ஋ʢ೥݄݄ͷฏۉ஋ʣ ˞ʮϚϚ޲͚/PΞϓϦʯ͸೥݄Πϯςʔδௐ΂ɹௐࠪର৅ɿ೛৷தʙ̎ࡀ̌ϲ݄ͷࢠڙΛ࣋ͭঁੑ O  Λநग़ ˞*OTUBHSBNͷϑΥϩϫʔ਺ɺ'BDFCPPLͷ͍͍Ͷ਺ɺ-*/&ͷͱ΋ͩͪ਺ͷ߹ܭ஋ ೥݄࣌఺  ϚϚϦ ΞϓϦɾ8FC

    4/4 *OTUBHSBNɾ-*/&ɾ'BDFCPPL هࣄ ϚϚಉ࢜Ͱ೰ΈΛ૬ஊ͠߹͏2"ίϛϡχςΟΛத৺ʹ ϢʔβʔΛ֦େ͍ͯ͠·͢ ʮϚϚϦʯͰϢʔβʔಉ͕࢜ ͲΜͲΜܨ͕͍ͬͯ·͢ ϚϚͷੜ׆ʹ໾ཱͭهࣄΛ ෯޿͍δϟϯϧͰ഑৴͍ͯ͠·͢ ϚϚ޲͚/P̍ΞϓϦʹબग़  ਓͷϚϚ͕બͿʮݱࡏ࢖͍ͬͯΔΞϓϦʯʹ ͯɺ߲໨ ଞͷϚϚʹΦεεϝ͍ͨ͠ɺೝ஌౓ɺ
 ར༻཰ɺརศੑɺ޷ײ౓ Ͱ̍ҐΛ֫ಘ͠·ͨ͠ هࣄ਺ 6,000 هࣄҎ্ ྦྷܭϑΝϯ਺ ໿ 85 ສਓ ˞ ݄ؒӾཡ਺ ໿ 1.5ԯճ ˞ ݄ؒར༻ऀ਺ ໿ 650ສਓ ˞ ˞ l೰ΈzͱzڞײzΛ࣠ʹϚϚʹدΓఴ͍ ΞϓϦɾ8FCɾ4/4ͱଟ֯తʹαʔϏεΛల։͍ͯ͠·͢
  3. 11.

  4. 14.

  5. 19.

    ͲΜͳػೳʁ w ίϯύΠϥʹҰ෦৚݅ΛՃ͑Δ͜ͱ͕Ͱ͖Δ w ϥϯλΠϜͰ͸ͳ͘ɺίϯύΠϧ࣌ʹద༻ w ੩తղੳͰ͖Δ w ؔ਺ʹద༻Ͱ͖Δ w

    Ͱಋೖ͞Εͨ&YQFSJNFOUBMͳػೳ w ݱ࣌఺Ͱͷߏจ͸&BSMZ1SPUPUZQF w ͔͠͠4UEMJCͰ΋ଟ਺ར༻͞Ε͍ͯΔ w %4-ܖ໿Λ݁Ϳ͜ͱͰ৚݅ΛࢦఆͰ͖Δ
  6. 20.

    ೥ද ,PUMJO ,PUMJO$POG։࠵ ͷൃදָ͕͠Έʂ ෆ۩߹मਖ਼ ,5 ,5 ,5ͳͲ ෆ۩߹मਖ਼ ,5

    ,5 $POUSBDUTϦϦʔεʂ ෆ۩߹मਖ਼ ,5 ,5 ,5ͳͲ ,PUMJO ,PUMJO ,PUMJO ,PUMJO ,PUMJO
  7. 21.

    είʔϓؔ਺Ͱ΋࠾༻͞Ε͍ͯΔ public inline fun <R> run( block: () -> R

    ): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } public inline fun <T> T.apply( block: T.() -> Unit ): T { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } block() return this } public inline fun <T, R> with( receiver: T, block: T.() -> R ): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return receiver.block() } public inline fun <T, R> T.let( block: (T) -> R ): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block(this) } SVO XJUI BQQMZ MFU
  8. 22.

    είʔϓؔ਺Ͱ΋࠾༻͞Ε͍ͯΔ public inline fun <R> run( block: () -> R

    ): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } public inline fun <T> T.apply( block: T.() -> Unit ): T { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } block() return this } public inline fun <T, R> with( receiver: T, block: T.() -> R ): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return receiver.block() } public inline fun <T, R> T.let( block: (T) -> R ): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block(this) } SVO XJUI BQQMZ MFU
  9. 23.

    w 3FTVMUHFU0S&MTF w 3FTVMUGPME w 3FTVMUNBQ w 3FTVMUSFDPWFS w 3FTVMUPO'BJMVSF

    w 3FTVMUPO4VDDFTT w SFRVJSF w SFRVJSF/PU/VMM w DIFDL w DIFDL/PU/VMM w FSSPS 4UEMJCͰͷར༻ঢ়گ w SVO w XJUI w BQQMZ w BMTP w MFU w UBLF*G w UBLF6OMFTT w SFQFBU w NFBTVSF5JNF w NFBTVSF5JNFE7BMVF w $IBS4FRVFODF JT/VMM0S&NQUZ w $IBS4FRVFODF JT/VMM0S#MBOL w $PMMFDUJPO JT/VMM0S&NQUZ w .BQ JT/VMM0S&NQUZ w "SSBZ JT/VMM0S&NQUZ Ͱ͸໿ϝιουʹରԠ
  10. 24.

    w 3FTVMUHFU0S&MTF w 3FTVMUGPME w 3FTVMUNBQ w 3FTVMUSFDPWFS w 3FTVMUPO'BJMVSF

    w 3FTVMUPO4VDDFTT w SFRVJSF w SFRVJSF/PU/VMM w DIFDL w DIFDL/PU/VMM w FSSPS 4UEMJCͰͷར༻ঢ়گ w SVO w XJUI w BQQMZ w BMTP w MFU w UBLF*G w UBLF6OMFTT w SFQFBU w NFBTVSF5JNF w NFBTVSF5JNFE7BMVF w $IBS4FRVFODF JT/VMM0S&NQUZ w $IBS4FRVFODF JT/VMM0S#MBOL w $PMMFDUJPO JT/VMM0S&NQUZ w .BQ JT/VMM0S&NQUZ w "SSBZ JT/VMM0S&NQUZ Ͱ͸໿ϝιουʹରԠ
  11. 28.
  12. 30.
  13. 32.
  14. 35.
  15. 47.
  16. 50.
  17. 53.
  18. 56.

    w ೚ҙͷߏจΛ࣮૷͢Δ͜ͱ͕Մೳ w ੍໿͕๛෋ͰOVMM OVMM USVF GBMTF @ ೚ҙ GBJMͳͲ͕͋Δ

    w Ҿ਺͸ෳ਺ࢦఆͰ͖Δ w "#zܗࣜɻ"Λϝιουʹఏڙ͢Δͱ#ΛಘΔͱ͍͏ҙ ຯͰͷܖ໿Λܗ੒ w γϯϘϧΛར༻͢Δ͜ͱͰɺҾ਺ͱ໭Γ஋ͷؒͷҼՌؔ܎ Λࣔ͢ !$POUSBDUϝϦοτ
  19. 63.

    جຊߏจ 'VODUJPO $POUSBDU &GGFDU &GGFDU &GGFDU w &GGFDU w $BMMT*O1MBDF

    w DBMMT*O1MBDF w $POEJUJPOBM&GGFDU w JNQMJFT w 4JNQMF&GGFDU w 3FUVSOT w SFUVSOT w 3FUVSOT/PU/VMM w SFUVSOT/PU/VMM
  20. 64.

    ݺͼग़͠ͷछྨ 'VODUJPO $POUSBDU &GGFDU &GGFDU &GGFDU w DBMMT*O1MBDF w *OWPDBUJPO,JOE

    w &9"$5-:@0/$& w "5@.045@0/$& w "5@-&"45@0/$& w 6/,/08/
  21. 79.
  22. 83.
  23. 94.

    w &YQFSJNFOUBMͳػೳ w มߋ͕͋Δ͔΋͠Εͳ͍ w ࣍ͷόʔδϣϯͰ͋ΔΛλʔήοτͨ͠*TTVF͕ଟ਺͋Δ w IUUQTZPVUSBDLKFUCSBJOTDPNJTTVF,5 w IUUQTZPVUSBDLKFUCSBJOTDPNJTTVF,5

    w IUUQTZPVUSBDLKFUCSBJOTDPNJTTVF,5 w Ͱ%FQSFDBUFEʹͳΔ͜ͱ͸ͳͦ͞͏ʂ w ,PUMJO$POGͰʹ͍ͭͯͷൃද͕͋ΔͷͰظ଴ʂ ࠓޙͷల։
  24. 111.