Slide 1

Slide 1 text

αʔόʔαΠυΤϯδχΞ ͷͨΊͷJ04ΞϓϦ։ൃೖ໳ !UZQFTUFS
 :"1$"TJB

Slide 2

Slide 2 text

J04ΞϓϦ։ൃ w 4XJGU w (PPECZF0CKFDUJWF$ w ແྉͰ࣮ػసૹՄೳʹ 9DPEFҎ߱ 
 IUUQTEFWFMPQFSBQQMFDPNYDPEF EPXOMPBET

Slide 3

Slide 3 text

࢝ΊΔʹ͸ྑ͍࣌ظʂ

Slide 4

Slide 4 text

1FSMUP4XJGU

Slide 5

Slide 5 text

$MBTT package Foo;
 use Moose;
 
 1;

Slide 6

Slide 6 text

$MBTT class Foo {
 }

Slide 7

Slide 7 text

*OIFSJUBODF package Dog;
 use Moose;
 
 extends ‘Animal’;
 
 1;

Slide 8

Slide 8 text

*OIFSJUBODF class Dog: Animal {
 }

Slide 9

Slide 9 text

JOTUBODFWBSJBCMF package Dog;
 use Moose;
 
 extends ‘Animal’;
 
 has ‘name’ => (
 is => ‘rw’,
 isa => ‘Str’,
 );
 
 1;

Slide 10

Slide 10 text

JOTUBODFWBSJBCMF class Dog: Animal {
 var name: String = “”
 }

Slide 11

Slide 11 text

MB[Z package Dog;
 use Moose;
 
 extends ‘Animal’;
 
 has ‘name’ => (
 is => ‘rw’,
 isa => ‘Str’,
 lazy => 1,
 default => sub {
 “John”;
 },
 );
 
 1;

Slide 12

Slide 12 text

MB[Z class Dog: Animal {
 @lazy var name: String = {
 return “John”
 }()
 }

Slide 13

Slide 13 text

JOJUJBMJ[FS package Dog;
 use Moose;
 
 extends ‘Animal’;
 
 sub BUILD {
 my ($self) = @_;
 # . . .
 }
 
 1;

Slide 14

Slide 14 text

JOJUJBMJ[FS class Dog: Animal {
 init() {
 // . . .
 }
 }

Slide 15

Slide 15 text

JOTUBODFGVODUJPO package Dog;
 use Moose;
 
 extends ‘Animal’;
 
 sub print_info {
 my ($self) = @_;
 printf ‘name=%s\n’, $self->name;
 }
 
 1;

Slide 16

Slide 16 text

JOTUBODFGVODUJPO my $dog = Dog->new;
 $dog->print_info;

Slide 17

Slide 17 text

JOTUBODFGVODUJPO class Dog: Animal {
 var name: String = “”
 
 func print_info() {
 println(“name=\(self.name)”)
 }
 }

Slide 18

Slide 18 text

JOTUBODFGVODUJPO var dog = Dog()
 dog.print_info()

Slide 19

Slide 19 text

େମΠϝʔδ͸఻Θͬ ͨͰ͠ΐ͏͔

Slide 20

Slide 20 text

࣮ࡍʹ͸4XJGUͷ΄͏͕ΊͪΌ ͪ͘Όػೳ๛෋ͳͷͰɺ͜ͷ ΍Γํʹ͸ແཧ͕͋Γ·͢ স

Slide 21

Slide 21 text

1FSM࢖͍͕4XJGUʹདྷͯ
 ҧ࿨ײͷͳ͍࠷େͷϙΠϯτ

Slide 22

Slide 22 text

ϦϑΝϨϯεΧ΢ϯτ ํࣜ

Slide 23

Slide 23 text

1FSMͰΑ͘΍Δϛε my $t = AnyEvent->timer(
 after => 10,
 cb => sub {
 $self->do_something;
 },
 );

Slide 24

Slide 24 text

1FSMͰΑ͘΍Δϛε my $t = AnyEvent->timer(
 after => 10,
 cb => sub {
 $self->do_something;
 },
 );

Slide 25

Slide 25 text

1FSMͰΑ͘΍Δϛε my $t = AnyEvent->timer(
 after => 10,
 cb => sub {
 $self->do_something;
 },
 );
 Scalar::Util::weaken($self);

Slide 26

Slide 26 text

*OTXJGU var t = Timer(10, cb: {
 () -> Void in
 self?.do_something()
 })

Slide 27

Slide 27 text

*OTXJGU var t = Timer(10, cb: {
 [weak self] () -> Void in
 self?.do_something()
 })

Slide 28

Slide 28 text

;FSPJOHXFBL w 4XJGU0CKFDUJWF$ͷXFBLࢀর͸
 ;FSPJOHXFBLͱݺ͹ΕΔ w 1FSMͷXFBLࢀর͸ϦϑΝϨϯεΧ΢ϯτ͕͞ Εͳ͍͚ͩ w 4XJGUͷ৔߹͸͞ΒʹɺࢀরΧ΢ϯτ͕ʹͳΔ ͱɺXFBLࢀর͍ͯ͠Δม਺͕ࣗಈతʹOJM [FSP ʹͳΔ

Slide 29

Slide 29 text

1FSMʹͳ͍͚Ͳॏཁͳ΍ͭΒ w 0QUJPOBMͱ͍͏֓೦ w 1SPUPDPM

Slide 30

Slide 30 text

0QUJPOBMͱ͍͏֓೦ w 4XJGUͰ͸
 WBSGPP4USJOH
 ͱఆٛͨ͠ม਺ʹ͸4USJOHҎ֎ೖΕΒΕͳ͍

Slide 31

Slide 31 text

0QUJPOBMͱ͍͏֓೦ w WBSGPP4USJOH 
 ͱఆٛ͢ΔͱPQUJPOBMʹͳΔ w OJMPS4USJOH͕୅ೖՄೳ

Slide 32

Slide 32 text

0QUJPOBMͱ͍͏֓೦ w ΞΫηε͢Δ࣌͸ w TFMGGPP
 OJMͩͬͨ࣌͸DSBTI w JGMFUGPPTFMGGPP\
 ^
 ͕͓ͬͪ͜͢͢Ί

Slide 33

Slide 33 text

0QUJPOBMͱ͍͏֓೦ w JGMFUCB[TFMGGPP CBS CB[\
 ^ w 0QUJPOBMΛશ෦ͨͲͬͯ࠷ޙ·ͰOJM͡Όͳ͔ͬ ͚ͨ࣌ͩ

Slide 34

Slide 34 text

0QUJPOBMͱ͍͏֓೦ w TFMGGPP EP@TPNFUIJOH w GPP͕OJMͩͬͨΒԿ΋͓͖ͳ͍

Slide 35

Slide 35 text

1SPUPDPM w (Pͷ*OUFSGBDFΈ͍ͨͳ΋ͷ w 4USVDU1SPUPDPMͰɺ΄Μͱʹ(PΈ͍ͨͳॻ ͖ํ΋Մೳ

Slide 36

Slide 36 text

$1"/$BSUPO

Slide 37

Slide 37 text

$PDPB1PET

Slide 38

Slide 38 text

w DQBOpMF1PEpMF w DBSUPOJOTUBMM'PP
 QPEJOTUBMM'PP

Slide 39

Slide 39 text

ͳΜ͔࡞ΔσϞ

Slide 40

Slide 40 text

ϙΠϯτ w ࠷ॳ͔Β׬ᘳͳ΋ͷΛ࡞Ζ͏ͱ͠ͳ͍ w ζϧͰ͖Δͱ͜Ζ͸ζϧ͢Δ w ࣗ෼͔͔ͭ͑͠ͳͯ͘ྑ͍ w ඞཁʹͳͬͨ΋ͷ͚͍֮ͩ͑ͯ͘ͷָ͕ͩ͠਎ ʹͭ͘

Slide 41

Slide 41 text

ϙΠϯτ w ຊ৬ αʔόαΠυ ͷೳྗΛۦ࢖ w ΫϥΠΞϯταΠυ͸ΊͬͪΌखൈ͖Ͱ͖ΔΑ ͏ʹαʔόͰ͕Μ͹Δ

Slide 42

Slide 42 text

ϙΠϯλ w ੲͱ͕ͪͬͯ৘ใ͕ͦΖ͍ͬͯΔͷͰ
 ͋Μ·Γۤ࿑͠ͳ͍͸ͣ w ެࣜνϡʔτϦΞϧ
 4UBSU%FWFMPQJOHJ04"QQT 4XJGU w Ұ෦೔ຊޠʹ΋ͳͬͯ·͢
 IUUQTEFWFMPQFSBQQMFDPNKQEPDVNFOUBUJPO w ϐϯϙΠϯτʹ΍Γ͍ͨ͜ͱɾ࢖͏ϑϨʔϜϫʔΫ໊ͰάάΔ
 ˠ4UBDLPWFSqPX RJJUB

Slide 43

Slide 43 text

2VFTUJPOT